Loading clang/include/clang/AST/Expr.h +6 −6 Original line number Diff line number Diff line Loading @@ -3955,13 +3955,13 @@ class StmtExpr : public Expr { Stmt *SubStmt; SourceLocation LParenLoc, RParenLoc; public: // FIXME: Does type-dependence need to be computed differently? // FIXME: Do we need to compute instantiation instantiation-dependence for // statements? (ugh!) StmtExpr(CompoundStmt *substmt, QualType T, SourceLocation lp, SourceLocation rp, bool InDependentContext) : // Note: we treat a statement-expression in a dependent context as always // being value- and instantiation-dependent. This matches the behavior of // lambda-expressions and GCC. SourceLocation lp, SourceLocation rp) : Expr(StmtExprClass, T, VK_RValue, OK_Ordinary, T->isDependentType(), InDependentContext, InDependentContext, false), T->isDependentType(), false, false, false), SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { } /// Build an empty statement expression. Loading clang/include/clang/Sema/Sema.h +1 −1 Original line number Diff line number Diff line Loading @@ -4923,7 +4923,7 @@ public: LabelDecl *TheDecl); void ActOnStartStmtExpr(); ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc); // "({..})" // Handle the final expression in a statement expression. ExprResult ActOnStmtExprResult(ExprResult E); Loading clang/lib/AST/ASTImporter.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -6724,9 +6724,8 @@ ExpectedStmt ASTNodeImporter::VisitStmtExpr(StmtExpr *E) { SourceLocation ToLParenLoc, ToRParenLoc; std::tie(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc) = *Imp; return new (Importer.getToContext()) StmtExpr(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc, E->isInstantiationDependent()); return new (Importer.getToContext()) StmtExpr( ToSubStmt, ToType, ToLParenLoc, ToRParenLoc); } ExpectedStmt ASTNodeImporter::VisitUnaryOperator(UnaryOperator *E) { Loading clang/lib/Parse/ParseExpr.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -2655,8 +2655,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, // If the substmt parsed correctly, build the AST node. if (!Stmt.isInvalid()) { Result = Actions.ActOnStmtExpr(getCurScope(), OpenLoc, Stmt.get(), Tok.getLocation()); Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.get(), Tok.getLocation()); } else { Actions.ActOnStmtExprError(); } Loading clang/lib/Sema/SemaExpr.cpp +4 −12 Original line number Diff line number Diff line Loading @@ -13908,7 +13908,8 @@ void Sema::ActOnStmtExprError() { PopExpressionEvaluationContext(); } ExprResult Sema::ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, ExprResult Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc) { // "({..})" assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!"); CompoundStmt *Compound = cast<CompoundStmt>(SubStmt); Loading Loading @@ -13938,18 +13939,9 @@ ExprResult Sema::ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, } } bool IsDependentContext = false; if (S) IsDependentContext = S->getTemplateParamParent() != nullptr; else // FIXME: This is not correct when substituting inside a templated // context that isn't a DeclContext (such as a variable template). IsDependentContext = CurContext->isDependentContext(); // FIXME: Check that expression type is complete/non-abstract; statement // expressions are not lvalues. Expr *ResStmtExpr = new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc, IsDependentContext); Expr *ResStmtExpr = new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc); if (StmtExprMayBindToTemp) return MaybeBindToTemporary(ResStmtExpr); return ResStmtExpr; Loading
clang/include/clang/AST/Expr.h +6 −6 Original line number Diff line number Diff line Loading @@ -3955,13 +3955,13 @@ class StmtExpr : public Expr { Stmt *SubStmt; SourceLocation LParenLoc, RParenLoc; public: // FIXME: Does type-dependence need to be computed differently? // FIXME: Do we need to compute instantiation instantiation-dependence for // statements? (ugh!) StmtExpr(CompoundStmt *substmt, QualType T, SourceLocation lp, SourceLocation rp, bool InDependentContext) : // Note: we treat a statement-expression in a dependent context as always // being value- and instantiation-dependent. This matches the behavior of // lambda-expressions and GCC. SourceLocation lp, SourceLocation rp) : Expr(StmtExprClass, T, VK_RValue, OK_Ordinary, T->isDependentType(), InDependentContext, InDependentContext, false), T->isDependentType(), false, false, false), SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { } /// Build an empty statement expression. Loading
clang/include/clang/Sema/Sema.h +1 −1 Original line number Diff line number Diff line Loading @@ -4923,7 +4923,7 @@ public: LabelDecl *TheDecl); void ActOnStartStmtExpr(); ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc); // "({..})" // Handle the final expression in a statement expression. ExprResult ActOnStmtExprResult(ExprResult E); Loading
clang/lib/AST/ASTImporter.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -6724,9 +6724,8 @@ ExpectedStmt ASTNodeImporter::VisitStmtExpr(StmtExpr *E) { SourceLocation ToLParenLoc, ToRParenLoc; std::tie(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc) = *Imp; return new (Importer.getToContext()) StmtExpr(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc, E->isInstantiationDependent()); return new (Importer.getToContext()) StmtExpr( ToSubStmt, ToType, ToLParenLoc, ToRParenLoc); } ExpectedStmt ASTNodeImporter::VisitUnaryOperator(UnaryOperator *E) { Loading
clang/lib/Parse/ParseExpr.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -2655,8 +2655,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, // If the substmt parsed correctly, build the AST node. if (!Stmt.isInvalid()) { Result = Actions.ActOnStmtExpr(getCurScope(), OpenLoc, Stmt.get(), Tok.getLocation()); Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.get(), Tok.getLocation()); } else { Actions.ActOnStmtExprError(); } Loading
clang/lib/Sema/SemaExpr.cpp +4 −12 Original line number Diff line number Diff line Loading @@ -13908,7 +13908,8 @@ void Sema::ActOnStmtExprError() { PopExpressionEvaluationContext(); } ExprResult Sema::ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, ExprResult Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc) { // "({..})" assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!"); CompoundStmt *Compound = cast<CompoundStmt>(SubStmt); Loading Loading @@ -13938,18 +13939,9 @@ ExprResult Sema::ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, } } bool IsDependentContext = false; if (S) IsDependentContext = S->getTemplateParamParent() != nullptr; else // FIXME: This is not correct when substituting inside a templated // context that isn't a DeclContext (such as a variable template). IsDependentContext = CurContext->isDependentContext(); // FIXME: Check that expression type is complete/non-abstract; statement // expressions are not lvalues. Expr *ResStmtExpr = new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc, IsDependentContext); Expr *ResStmtExpr = new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc); if (StmtExprMayBindToTemp) return MaybeBindToTemporary(ResStmtExpr); return ResStmtExpr;