Add PushConditionalTempDestruction/PopConditionalTempDestruction.

llvm-svn: 72835
This commit is contained in:
Anders Carlsson 2009-06-04 02:22:12 +00:00
parent 8936009a91
commit 44bfcf0f97
2 changed files with 30 additions and 0 deletions

View File

@ -67,3 +67,14 @@ CodeGenFunction::EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E,
return RV;
}
void
CodeGenFunction::PushConditionalTempDestruction() {
// Store the current number of live temporaries.
ConditionalTempDestructionStack.push_back(LiveTemporaries.size());
}
void CodeGenFunction::PopConditionalTempDestruction() {
ConditionalTempDestructionStack.pop_back();
}

View File

@ -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;
@ -264,6 +278,11 @@ 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;
public:
CodeGenFunction(CodeGenModule &cgm);