1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions -std=c++11 | FileCheck %s
3 // Ensure that we call __cxa_begin_catch before calling
4 // std::terminate in a noexcept function.
13 void test() noexcept
{
19 // CHECK-LABEL: define{{.*}} void @_ZN5test04testEv()
20 // This goes to the terminate lpad.
21 // CHECK: invoke void @_ZN5test01AC1Ev(
22 // CHECK-NEXT: unwind label %[[TERMINATE_LPAD:.*]]
23 // This also goes to the terminate lpad (no cleanups!).
24 // CHECK: invoke void @_ZN5test03fooEv()
25 // CHECK-NEXT: unwind label %[[TERMINATE_LPAD]]
26 // Destructors don't throw by default in C++11.
27 // CHECK: call void @_ZN5test01AD1Ev(
29 // CHECK: [[TERMINATE_LPAD]]:
30 // CHECK-NEXT: [[T0:%.*]] = landingpad
31 // CHECK-NEXT: catch ptr null
32 // CHECK-NEXT: [[T1:%.*]] = extractvalue { ptr, i32 } [[T0]], 0
33 // CHECK-NEXT: call void @__clang_call_terminate(ptr [[T1]])
34 // CHECK-NEXT: unreachable
36 // CHECK-LABEL: define linkonce_odr hidden void @__clang_call_terminate(
37 // CHECK: call ptr @__cxa_begin_catch(
38 // CHECK-NEXT: call void @_ZSt9terminatev()
39 // CHECK-NEXT: unreachable