1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions -std=c++11 | FileCheck %s 2 3 // rdar://11904428 4 // Ensure that we call __cxa_begin_catch before calling 5 // std::terminate in a noexcept function. 6 namespace test0 { 7 void foo(); 8 9 struct A { 10 A(); 11 ~A(); 12 }; 13 14 void test() noexcept { 15 A a; 16 foo(); 17 } 18 } 19 20 // CHECK-LABEL: define{{.*}} void @_ZN5test04testEv() 21 // This goes to the terminate lpad. 22 // CHECK: invoke void @_ZN5test01AC1Ev( 23 // CHECK-NEXT: unwind label %[[TERMINATE_LPAD:.*]] 24 // This also goes to the terminate lpad (no cleanups!). 25 // CHECK: invoke void @_ZN5test03fooEv() 26 // CHECK-NEXT: unwind label %[[TERMINATE_LPAD]] 27 // Destructors don't throw by default in C++11. 28 // CHECK: call void @_ZN5test01AD1Ev( 29 // Cleanup lpad. 30 // CHECK: [[TERMINATE_LPAD]]: 31 // CHECK-NEXT: [[T0:%.*]] = landingpad 32 // CHECK-NEXT: catch i8* null 33 // CHECK-NEXT: [[T1:%.*]] = extractvalue { i8*, i32 } [[T0]], 0 34 // CHECK-NEXT: call void @__clang_call_terminate(i8* [[T1]]) 35 // CHECK-NEXT: unreachable 36 37 // CHECK-LABEL: define linkonce_odr hidden void @__clang_call_terminate( 38 // CHECK: call i8* @__cxa_begin_catch( 39 // CHECK-NEXT: call void @_ZSt9terminatev() 40 // CHECK-NEXT: unreachable 41