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 | 1a343ebbf413e8eae6b2737b2b2d79cbf5765571 (patch) | |
tree | f19088ff715fded786ec81b96a04bcceadff0b12 /lib/CodeGen/CodeGenFunction.h | |
parent | 180f47959a066795cc0f409433023af448bb0328 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144268 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 383eb587ca..c3aca51555 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -45,6 +45,7 @@ namespace llvm { namespace clang { class APValue; class ASTContext; + class BlockDecl; class CXXDestructorDecl; class CXXForRangeStmt; class CXXTryStmt; @@ -610,6 +611,9 @@ public: unsigned NextCleanupDestIndex; + /// FirstBlockInfo - The head of a singly-linked-list of block layouts. + CGBlockInfo *FirstBlockInfo; + /// EHResumeBlock - Unified block containing a call to llvm.eh.resume. llvm::BasicBlock *EHResumeBlock; @@ -1169,6 +1173,7 @@ private: public: CodeGenFunction(CodeGenModule &cgm); + ~CodeGenFunction(); CodeGenTypes &getTypes() const { return CGM.getTypes(); } ASTContext &getContext() const { return CGM.getContext(); } @@ -1297,6 +1302,8 @@ public: //===--------------------------------------------------------------------===// llvm::Value *EmitBlockLiteral(const BlockExpr *); + llvm::Value *EmitBlockLiteral(const CGBlockInfo &Info); + static void destroyBlockInfos(CGBlockInfo *info); llvm::Constant *BuildDescriptorBlockDecl(const BlockExpr *, const CGBlockInfo &Info, llvm::StructType *, @@ -2074,7 +2081,6 @@ public: LValue EmitCXXConstructLValue(const CXXConstructExpr *E); LValue EmitCXXBindTemporaryLValue(const CXXBindTemporaryExpr *E); - LValue EmitExprWithCleanupsLValue(const ExprWithCleanups *E); LValue EmitCXXTypeidLValue(const CXXTypeidExpr *E); LValue EmitObjCMessageExprLValue(const ObjCMessageExpr *E); @@ -2348,8 +2354,11 @@ public: void EmitSynthesizedCXXCopyCtor(llvm::Value *Dest, llvm::Value *Src, const Expr *Exp); - RValue EmitExprWithCleanups(const ExprWithCleanups *E, - AggValueSlot Slot =AggValueSlot::ignored()); + void enterFullExpression(const ExprWithCleanups *E) { + if (E->getNumObjects() == 0) return; + enterNonTrivialFullExpression(E); + } + void enterNonTrivialFullExpression(const ExprWithCleanups *E); void EmitCXXThrowExpr(const CXXThrowExpr *E); |