diff options
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index d424f388f63..9339c04c513 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -8546,12 +8546,26 @@ static Expr *maybeRebuildARCConsumingStmt(Stmt *Statement) { return cleanups; } +void Sema::ActOnStartStmtExpr() { + PushExpressionEvaluationContext(ExprEvalContexts.back().Context); +} + +void Sema::ActOnStmtExprError() { + DiscardCleanupsInEvaluationContext(); + PopExpressionEvaluationContext(); +} + ExprResult Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc) { // "({..})" assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!"); CompoundStmt *Compound = cast<CompoundStmt>(SubStmt); + if (hasAnyUnrecoverableErrorsInThisFunction()) + DiscardCleanupsInEvaluationContext(); + assert(!ExprNeedsCleanups && "cleanups within StmtExpr not correctly bound!"); + PopExpressionEvaluationContext(); + bool isFileScope = (getCurFunctionOrMethodDecl() == 0) && (getCurBlock() == 0); if (isFileScope) |