[cfe-commits] r108994 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CGExpr.cpp CodeGenFunction.h
John McCall
rjmccall at apple.com
Tue Jul 20 23:29:51 PDT 2010
Author: rjmccall
Date: Wed Jul 21 01:29:51 2010
New Revision: 108994
URL: http://llvm.org/viewvc/llvm-project?rev=108994&view=rev
Log:
Switch the destructor for a temporary arising from a reference binding over to
using a lazy cleanup.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=108994&r1=108993&r2=108994&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Wed Jul 21 01:29:51 2010
@@ -1178,14 +1178,18 @@
};
}
+void CodeGenFunction::PushDestructorCleanup(const CXXDestructorDecl *D,
+ llvm::Value *Addr) {
+ EHStack.pushLazyCleanup<CallLocalDtor>(NormalAndEHCleanup, D, Addr);
+}
+
void CodeGenFunction::PushDestructorCleanup(QualType T, llvm::Value *Addr) {
CXXRecordDecl *ClassDecl = T->getAsCXXRecordDecl();
if (!ClassDecl) return;
if (ClassDecl->hasTrivialDestructor()) return;
const CXXDestructorDecl *D = ClassDecl->getDestructor();
-
- EHStack.pushLazyCleanup<CallLocalDtor>(NormalAndEHCleanup, D, Addr);
+ PushDestructorCleanup(D, Addr);
}
llvm::Value *
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=108994&r1=108993&r2=108994&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Jul 21 01:29:51 2010
@@ -362,16 +362,8 @@
return RValue::get(Value);
}
}
-
- CleanupBlock Cleanup(*this, NormalCleanup);
- EmitCXXDestructorCall(ReferenceTemporaryDtor, Dtor_Complete,
- /*ForVirtualBase=*/false, ReferenceTemporary);
-
- if (Exceptions) {
- Cleanup.beginEHCleanup();
- EmitCXXDestructorCall(ReferenceTemporaryDtor, Dtor_Complete,
- /*ForVirtualBase=*/false, ReferenceTemporary);
- }
+
+ PushDestructorCleanup(ReferenceTemporaryDtor, ReferenceTemporary);
return RValue::get(Value);
}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=108994&r1=108993&r2=108994&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Jul 21 01:29:51 2010
@@ -466,6 +466,12 @@
/// non-trivial destructor.
void PushDestructorCleanup(QualType T, llvm::Value *Addr);
+ /// PushDestructorCleanup - Push a cleanup to call the
+ /// complete-object variant of the given destructor on the object at
+ /// the given address.
+ void PushDestructorCleanup(const CXXDestructorDecl *Dtor,
+ llvm::Value *Addr);
+
/// PopCleanupBlock - Will pop the cleanup entry on the stack and
/// process all branch fixups.
void PopCleanupBlock();
More information about the cfe-commits
mailing list