diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-15 17:55:51 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-15 17:55:51 +0000 |
commit | 58142dd8a1c9d682c7ce14bba3671f6d73dd3083 (patch) | |
tree | 4354565d209e8de9b90518f6e0ac95fd4912378d /clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp | |
parent | 4f0ed426010a8c97cd780d9095b8842135fc983e (diff) | |
download | bcm5719-llvm-58142dd8a1c9d682c7ce14bba3671f6d73dd3083.tar.gz bcm5719-llvm-58142dd8a1c9d682c7ce14bba3671f6d73dd3083.zip |
When initializing thread-safe statics, put the call to
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures.
llvm-svn: 103880
Diffstat (limited to 'clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp b/clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp new file mode 100644 index 00000000000..fcb6ccefea0 --- /dev/null +++ b/clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -emit-llvm -o - -fexceptions -triple x86_64-apple-darwin10 %s | FileCheck %s + +struct X { + X(); + ~X(); +}; + +struct Y { }; + +// CHECK: define void @_Z1fv +void f() { + // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZ1fvE1x) + // CHECK: invoke void @_ZN1XC1Ev + // CHECK: call void @__cxa_guard_release(i64* @_ZGVZ1fvE1x) + // CHECK: call i32 @__cxa_atexit + // CHECK: br + static X x; + // CHECK: call void @__cxa_guard_abort(i64* @_ZGVZ1fvE1x) + // CHECK: call void @__cxa_rethrow() noreturn + // CHECK: unreachable + + // CHECK: call i8* @__cxa_allocate_exception + throw Y(); +} |