diff options
author | John McCall <rjmccall@apple.com> | 2011-11-10 08:15:53 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-11-10 08:15:53 +0000 |
commit | 08ef466048e06328401fd06527b20315902cab19 (patch) | |
tree | 01f03a622005ef6cc5d4967c1bbed7623bd3380f /clang/lib/CodeGen/CGObjC.cpp | |
parent | d33b2d6b7a7aacb6fe9db39b0b6c529dafba057c (diff) | |
download | bcm5719-llvm-08ef466048e06328401fd06527b20315902cab19.tar.gz bcm5719-llvm-08ef466048e06328401fd06527b20315902cab19.zip |
Enter the cleanups for a block outside the enclosing
full-expression. Naturally they're inactive before we enter
the block literal expression. This restores the intended
behavior that blocks belong to their enclosing scope.
There's a useful -O0 / compile-time optimization that we're
missing here with activating cleanups following straight-line
code from their inactive beginnings.
llvm-svn: 144268
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 88d19a3b6c9..686f0e68334 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -2177,6 +2177,7 @@ static TryEmitResult tryEmitARCRetainScalarExpr(CodeGenFunction &CGF, const Expr *e) { // Look through cleanups. if (const ExprWithCleanups *cleanups = dyn_cast<ExprWithCleanups>(e)) { + CGF.enterFullExpression(cleanups); CodeGenFunction::RunCleanupsScope scope(CGF); return tryEmitARCRetainScalarExpr(CGF, cleanups->getSubExpr()); } @@ -2376,10 +2377,12 @@ llvm::Value *CodeGenFunction::EmitObjCThrowOperand(const Expr *expr) { // @throw A().foo; // where a full retain+autorelease is required and would // otherwise happen after the destructor for the temporary. - CodeGenFunction::RunCleanupsScope cleanups(*this); - if (const ExprWithCleanups *ewc = dyn_cast<ExprWithCleanups>(expr)) + if (const ExprWithCleanups *ewc = dyn_cast<ExprWithCleanups>(expr)) { + enterFullExpression(ewc); expr = ewc->getSubExpr(); + } + CodeGenFunction::RunCleanupsScope cleanups(*this); return EmitARCRetainAutoreleaseScalarExpr(expr); } |