diff options
author | Anders Carlsson <andersca@mac.com> | 2009-11-20 17:27:56 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-11-20 17:27:56 +0000 |
commit | 0a66c2619104c7e9f9a0db15f151d1a03a648142 (patch) | |
tree | 03215020c717d2c4662419cbaf361bea38aa573c /clang/lib/CodeGen/CodeGenFunction.h | |
parent | 9c7efbb996e7513fa0d8d59f0cc993f4fe55fe95 (diff) | |
download | bcm5719-llvm-0a66c2619104c7e9f9a0db15f151d1a03a648142.tar.gz bcm5719-llvm-0a66c2619104c7e9f9a0db15f151d1a03a648142.zip |
Fix lifetime of conditional temporaries. Patch by Victor Zverovich!
llvm-svn: 89467
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index d96c3551010..0be527c8d46 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -176,19 +176,23 @@ public: /// this behavior for branches? void EmitBranchThroughCleanup(llvm::BasicBlock *Dest); - /// PushConditionalTempDestruction - Should be called before a conditional - /// part of an expression is emitted. For example, before the RHS of the - /// expression below is emitted: + /// StartConditionalBranch - Should be called before a conditional part of an + /// expression is emitted. For example, before the RHS of the expression below + /// is emitted: /// /// b && f(T()); /// - /// This is used to make sure that any temporaryes created in the conditional + /// This is used to make sure that any temporaries created in the conditional /// branch are only destroyed if the branch is taken. - void PushConditionalTempDestruction(); + void StartConditionalBranch() { + ++ConditionalBranchLevel; + } - /// PopConditionalTempDestruction - Should be called after a conditional - /// part of an expression has been emitted. - void PopConditionalTempDestruction(); + /// FinishConditionalBranch - Should be called after a conditional part of an + /// expression has been emitted. + void FinishConditionalBranch() { + --ConditionalBranchLevel; + } private: CGDebugInfo *DebugInfo; @@ -298,10 +302,10 @@ private: llvm::SmallVector<CXXLiveTemporaryInfo, 4> LiveTemporaries; - /// ConditionalTempDestructionStack - Contains the number of live temporaries - /// when PushConditionalTempDestruction was called. This is used so that - /// we know how many temporaries were created by a certain expression. - llvm::SmallVector<size_t, 4> ConditionalTempDestructionStack; + /// ConditionalBranchLevel - Contains the nesting level of the current + /// conditional branch. This is used so that we know if a temporary should be + /// destroyed conditionally. + unsigned ConditionalBranchLevel; /// ByrefValueInfoMap - For each __block variable, contains a pair of the LLVM |