diff options
author | John McCall <rjmccall@apple.com> | 2010-07-13 22:12:14 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-07-13 22:12:14 +0000 |
commit | 8e3f86193995c47ee0d229e4336c3382410f09f5 (patch) | |
tree | 0668cf7ba484f2e863aa0d937fd156672b004af5 /test/CodeGenCXX/eh.cpp | |
parent | ae415dc21ee6402cee1675ec8bb965a24f9e5b6b (diff) |
Allow for the possibility that __cxa_end_catch might throw for a catch-all block
or a catch of a record type by value or reference. Also convert this to a
lazy cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108287 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/eh.cpp')
-rw-r--r-- | test/CodeGenCXX/eh.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp index f8d7ef69e0..6d79c3e17b 100644 --- a/test/CodeGenCXX/eh.cpp +++ b/test/CodeGenCXX/eh.cpp @@ -181,11 +181,7 @@ namespace test8 { // CHECK-NEXT: invoke void @_ZN5test81AC1ERKS0_( // CHECK: call i8* @__cxa_begin_catch // CHECK-NEXT: invoke void @_ZN5test81AD1Ev( - // CHECK: call void @__cxa_end_catch() - // CHECK-NEXT: load - // CHECK-NEXT: switch - // CHECK: ret void } } @@ -217,3 +213,39 @@ namespace test9 { // CHECK: call i8* @llvm.eh.exception // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* {{.*}}, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*), i8* null) } + +// __cxa_end_catch can throw for some kinds of caught exceptions. +namespace test10 { + void opaque(); + + struct A { ~A(); }; + struct B { int x; }; + + // CHECK: define void @_ZN6test103fooEv() + void foo() { + A a; // force a cleanup context + + try { + // CHECK: invoke void @_ZN6test106opaqueEv() + opaque(); + } catch (int i) { + // CHECK: call i8* @__cxa_begin_catch + // CHECK-NEXT: bitcast + // CHECK-NEXT: load i32* + // CHECK-NEXT: store i32 + // CHECK-NEXT: call void @__cxa_end_catch() nounwind + } catch (B a) { + // CHECK: call i8* @__cxa_begin_catch + // CHECK-NEXT: bitcast + // CHECK-NEXT: bitcast + // CHECK-NEXT: bitcast + // CHECK-NEXT: call void @llvm.memcpy + // CHECK-NEXT: invoke void @__cxa_end_catch() + } catch (...) { + // CHECK: call i8* @__cxa_begin_catch + // CHECK-NEXT: invoke void @__cxa_end_catch() + } + + // CHECK: call void @_ZN6test101AD1Ev( + } +} |