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 | 62eb9a8e843cd9a1b07b7204a3cb3a35d4662b60 (patch) | |
tree | fba1756de0a16da32f63af03feb6f2e5848797bb | |
parent | 53c502204046ac583f447903272a2aa1288e5b8e (diff) | |
download | bcm5719-llvm-62eb9a8e843cd9a1b07b7204a3cb3a35d4662b60.tar.gz bcm5719-llvm-62eb9a8e843cd9a1b07b7204a3cb3a35d4662b60.zip |
When initializing a static local, pop the guard-abort EH cleanup after
the variable is fully initialized.
llvm-svn: 110704
-rw-r--r-- | clang/lib/CodeGen/CGDeclCXX.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index ddb1abc70a1..38345e47419 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/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/clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp b/clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp index 17c10301d4f..c91590fd58b 100644 --- a/clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp +++ b/clang/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. |