From 1d8475067d5b62ed5a57ba93862e23f3096a8bdd Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 4 Jun 2009 02:22:12 +0000 Subject: Add PushConditionalTempDestruction/PopConditionalTempDestruction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72835 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/CodeGen/CodeGenFunction.h') diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index c91a052cd5..72c4aa4a65 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -160,6 +160,20 @@ 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: + /// + /// b && f(T()); + /// + /// This is used to make sure that any temporaryes created in the conditional + /// branch are only destroyed if the branch is taken. + void PushConditionalTempDestruction(); + + /// PopConditionalTempDestruction - Should be called after a conditional + /// part of an expression has been emitted. + void PopConditionalTempDestruction(); + private: CGDebugInfo* DebugInfo; @@ -263,6 +277,11 @@ private: }; llvm::SmallVector 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 ConditionalTempDestructionStack; public: CodeGenFunction(CodeGenModule &cgm); -- cgit v1.2.3-18-g5258