diff options
author | John McCall <rjmccall@apple.com> | 2010-08-10 18:51:44 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-10 18:51:44 +0000 |
commit | 224124c7b85596157201a67a7ba12d2b0f5c153c (patch) | |
tree | 5e5402e686f062648b0ab3f4bfd61e958542e1fe | |
parent | 17c6c855754be4097572c9a8d9da805f16a37e97 (diff) |
When initializing a static local, pop the guard-abort EH cleanup after
the variable is fully initialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110704 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGDeclCXX.cpp | 4 | ||||
-rw-r--r-- | test/CodeGenCXX/threadsafe-statics-exceptions.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index ddb1abc70a..38345e4741 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/lib/CodeGen/CGDeclCXX.cpp @@ -398,6 +398,10 @@ CodeGenFunction::EmitStaticCXXBlockVarDeclInit(const VarDecl &D, EmitDeclInit(*this, D, GV); if (ThreadsafeStatics) { + // Pop the guard-abort cleanup if we pushed one. + if (Exceptions) + PopCleanupBlock(); + // Call __cxa_guard_release. This cannot throw. Builder.CreateCall(getGuardReleaseFn(*this), GuardVariable); } else { diff --git a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp index 17c10301d4..c91590fd58 100644 --- a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp +++ b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp @@ -17,7 +17,7 @@ void f() { static X x; // CHECK: call i8* @__cxa_allocate_exception - // CHECK: invoke void @__cxa_throw + // CHECK: call void @__cxa_throw throw Y(); // Finally, the landing pad. |