summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-21 20:05:31 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-21 20:05:31 +0000
commit5dbc14f47eda4e799a9878a1a1b990ae0287f38c (patch)
tree152651302cd002221e85ea96d03564a8dae2004f /clang/lib/Sema
parent9a2b7e820c79055ee83652ffc0321566f4bddf1f (diff)
downloadbcm5719-llvm-5dbc14f47eda4e799a9878a1a1b990ae0287f38c.tar.gz
bcm5719-llvm-5dbc14f47eda4e799a9878a1a1b990ae0287f38c.zip
Only pop the expression evaluation context corresponding to a lambda
expression after we've finished the function body of the corresponding function call operator. Otherwise, ActOnFinishFunctionBody() will see the (unfinished) evaluation context of the lambda expression itself. Fixes PR12031. llvm-svn: 151082
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaLambda.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index 42040084e10..016322fe523 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -511,10 +511,6 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
llvm::Optional<unsigned> ManglingNumber,
Decl *ContextDecl,
bool IsInstantiation) {
- // Leave the expression-evaluation context.
- DiscardCleanupsInEvaluationContext();
- PopExpressionEvaluationContext();
-
// Collect information from the lambda scope.
llvm::SmallVector<LambdaExpr::Capture, 4> Captures;
llvm::SmallVector<Expr *, 4> CaptureInits;
@@ -631,6 +627,7 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
ActOnFinishFunctionBody(CallOperator, Body, IsInstantiation);
CallOperator->setLexicalDeclContext(Class);
Class->addDecl(CallOperator);
+ PopExpressionEvaluationContext();
// C++11 [expr.prim.lambda]p6:
// The closure type for a lambda-expression with no lambda-capture
@@ -654,7 +651,6 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
ActOnFields(0, Class->getLocation(), Class, Fields,
SourceLocation(), SourceLocation(), 0);
CheckCompletedCXXClass(Class);
-
}
if (LambdaExprNeedsCleanups)
OpenPOWER on IntegriCloud