[cfe-commits] r108993 - /cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
John McCall
rjmccall at apple.com
Tue Jul 20 23:20:50 PDT 2010
Author: rjmccall
Date: Wed Jul 21 01:20:50 2010
New Revision: 108993
URL: http://llvm.org/viewvc/llvm-project?rev=108993&view=rev
Log:
Switch the __cxa_guard_abort cleanup to being a lazy cleanup.
Modified:
cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=108993&r1=108992&r2=108993&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Wed Jul 21 01:20:50 2010
@@ -329,6 +329,20 @@
return CGF.CGM.CreateRuntimeFunction(FTy, "__cxa_guard_abort");
}
+namespace {
+ struct CallGuardAbort : EHScopeStack::LazyCleanup {
+ llvm::GlobalVariable *Guard;
+ CallGuardAbort(llvm::GlobalVariable *Guard) : Guard(Guard) {}
+
+ void Emit(CodeGenFunction &CGF, bool IsForEH) {
+ // It shouldn't be possible for this to throw, but if it can,
+ // this should allow for the possibility of an invoke.
+ CGF.Builder.CreateCall(getGuardAbortFn(CGF), Guard)
+ ->setDoesNotThrow();
+ }
+ };
+}
+
void
CodeGenFunction::EmitStaticCXXBlockVarDeclInit(const VarDecl &D,
llvm::GlobalVariable *GV) {
@@ -341,7 +355,7 @@
CGM.getMangleContext().mangleGuardVariable(&D, GuardVName);
// Create the guard variable.
- llvm::GlobalValue *GuardVariable =
+ llvm::GlobalVariable *GuardVariable =
new llvm::GlobalVariable(CGM.getModule(), Int64Ty,
false, GV->getLinkage(),
llvm::Constant::getNullValue(Int64Ty),
@@ -373,10 +387,8 @@
InitBlock, EndBlock);
// Call __cxa_guard_abort along the exceptional edge.
- if (Exceptions) {
- CleanupBlock Cleanup(*this, EHCleanup);
- Builder.CreateCall(getGuardAbortFn(*this), GuardVariable);
- }
+ if (Exceptions)
+ EHStack.pushLazyCleanup<CallGuardAbort>(EHCleanup, GuardVariable);
EmitBlock(InitBlock);
}
More information about the cfe-commits
mailing list