git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72796 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anders Carlsson 2009-06-03 19:05:16 +00:00
Родитель 4e2567d6b1
Коммит f4b8fea84a
2 изменённых файлов: 26 добавлений и 11 удалений

Просмотреть файл

@ -17,17 +17,31 @@ using namespace CodeGen;
void CodeGenFunction::PushCXXTemporary(const CXXTemporary *Temporary,
llvm::Value *Ptr) {
LiveTemporaries.push_back(CXXLiveTemporaryInfo(Temporary, Ptr, 0, 0));
// Make a cleanup scope and emit the destructor.
{
CleanupScope Scope(*this);
EmitCXXDestructorCall(Temporary->getDestructor(), Dtor_Complete, Ptr);
}
llvm::BasicBlock *DtorBlock = createBasicBlock("temp.dtor");
LiveTemporaries.push_back(CXXLiveTemporaryInfo(Temporary, Ptr, DtorBlock, 0));
}
RValue
void CodeGenFunction::PopCXXTemporary() {
const CXXLiveTemporaryInfo& Info = LiveTemporaries.back();
CleanupBlockInfo CleanupInfo = PopCleanupBlock();
assert(CleanupInfo.CleanupBlock == Info.DtorBlock &&
"Cleanup block mismatch!");
assert(!CleanupInfo.SwitchBlock &&
"Should not have a switch block for temporary cleanup!");
assert(!CleanupInfo.EndBlock &&
"Should not have an end block for temporary cleanup!");
EmitBlock(Info.DtorBlock);
EmitCXXDestructorCall(Info.Temporary->getDestructor(),
Dtor_Complete, Info.ThisPtr);
LiveTemporaries.pop_back();
}
RValue
CodeGenFunction::EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E,
llvm::Value *AggLoc,
bool isAggLocVolatile) {

Просмотреть файл

@ -256,8 +256,8 @@ private:
llvm::Value *CondPtr;
CXXLiveTemporaryInfo(const CXXTemporary *temporary,
llvm::Value *thisptr, llvm::Value *condptr,
llvm::BasicBlock *dtorblock)
llvm::Value *thisptr, llvm::BasicBlock *dtorblock,
llvm::Value *condptr)
: Temporary(temporary), ThisPtr(thisptr), DtorBlock(dtorblock),
CondPtr(condptr) { }
};
@ -506,6 +506,7 @@ public:
llvm::Value *This);
void PushCXXTemporary(const CXXTemporary *Temporary, llvm::Value *Ptr);
void PopCXXTemporary();
llvm::Value *EmitCXXNewExpr(const CXXNewExpr *E);