[cfe-commits] r108979 - /cfe/trunk/lib/CodeGen/CGClass.cpp
John McCall
rjmccall at apple.com
Tue Jul 20 18:41:18 PDT 2010
Author: rjmccall
Date: Tue Jul 20 20:41:18 2010
New Revision: 108979
URL: http://llvm.org/viewvc/llvm-project?rev=108979&view=rev
Log:
Change PushDestructorCleanup to use lazy cleanups.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=108979&r1=108978&r2=108979&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Tue Jul 20 20:41:18 2010
@@ -1144,6 +1144,21 @@
EmitCXXMemberCall(DD, Callee, ReturnValueSlot(), This, VTT, 0, 0);
}
+namespace {
+ struct CallLocalDtor : EHScopeStack::LazyCleanup {
+ const CXXDestructorDecl *Dtor;
+ llvm::Value *Addr;
+
+ CallLocalDtor(const CXXDestructorDecl *D, llvm::Value *Addr)
+ : Dtor(D), Addr(Addr) {}
+
+ void Emit(CodeGenFunction &CGF, bool IsForEH) {
+ CGF.EmitCXXDestructorCall(Dtor, Dtor_Complete,
+ /*ForVirtualBase=*/false, Addr);
+ }
+ };
+}
+
void CodeGenFunction::PushDestructorCleanup(QualType T, llvm::Value *Addr) {
CXXRecordDecl *ClassDecl = T->getAsCXXRecordDecl();
if (!ClassDecl) return;
@@ -1151,14 +1166,7 @@
const CXXDestructorDecl *D = ClassDecl->getDestructor();
- CleanupBlock Scope(*this, NormalCleanup);
-
- EmitCXXDestructorCall(D, Dtor_Complete, /*ForVirtualBase=*/false, Addr);
-
- if (Exceptions) {
- Scope.beginEHCleanup();
- EmitCXXDestructorCall(D, Dtor_Complete, /*ForVirtualBase=*/false, Addr);
- }
+ EHStack.pushLazyCleanup<CallLocalDtor>(NormalAndEHCleanup, D, Addr);
}
llvm::Value *
More information about the cfe-commits
mailing list