summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2016-05-04 18:07:20 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2016-05-04 18:07:20 +0000
commitc482acd2e5b9d37ae5f34740e20cb0d44468364a (patch)
tree00f78d68bc800acc92ed38b233276423f59551e5 /clang/lib/Sema
parent1a14f0d25cf15f698707d53eb13acfc88a7e2b32 (diff)
downloadbcm5719-llvm-c482acd2e5b9d37ae5f34740e20cb0d44468364a.tar.gz
bcm5719-llvm-c482acd2e5b9d37ae5f34740e20cb0d44468364a.zip
[ObjC] Enter a new evaluation context before calling
BuildBlockForLambdaConversion. Previously, clang would build an incorrect AST for the following code: id test() { return @{@"a": [](){}, @"b": [](){}}; } ReturnStmt 0x10d080448 `-ExprWithCleanups 0x10d080428 |-cleanup Block 0x10d0801f0 // points to the second BlockDecl ... -BlockDecl 0x10d07f150 // First block ... -BlockDecl 0x10d0801f0 // Second block ... `-ExprWithCleanups 0x10d0801d0 |-cleanup Block 0x10d07f150 // points to the first BlockDecl To fix the bug, this commit enters a new evaluation context to reset ExprNeedsCleanups before each block is parsed. rdar://problem/16879958 Differential Revision: http://reviews.llvm.org/D18815 llvm-svn: 268527
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 88f2bc798a2..e11d9c84fea 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -6229,9 +6229,12 @@ ExprResult Sema::BuildCXXMemberCallExpr(Expr *E, NamedDecl *FoundDecl,
// follows the normal lifetime rules for block literals instead of being
// autoreleased.
DiagnosticErrorTrap Trap(Diags);
+ PushExpressionEvaluationContext(PotentiallyEvaluated);
ExprResult Exp = BuildBlockForLambdaConversion(E->getExprLoc(),
E->getExprLoc(),
Method, E);
+ PopExpressionEvaluationContext();
+
if (Exp.isInvalid())
Diag(E->getExprLoc(), diag::note_lambda_to_block_conv);
return Exp;
OpenPOWER on IntegriCloud