brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · adc9d84 Raw
40 lines · cpp
1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions -std=c++11 | FileCheck %s2 3//   Ensure that we call __cxa_begin_catch before calling4//   std::terminate in a noexcept function.5namespace test0 {6  void foo();7 8  struct A {9    A();10    ~A();11  };12 13  void test() noexcept {14    A a;15    foo();16  }17}18 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(28//   Cleanup lpad.29// CHECK: [[TERMINATE_LPAD]]:30// CHECK-NEXT: [[T0:%.*]] = landingpad31// CHECK-NEXT:   catch ptr null32// CHECK-NEXT: [[T1:%.*]] = extractvalue { ptr, i32 } [[T0]], 033// CHECK-NEXT: call void @__clang_call_terminate(ptr [[T1]])34// CHECK-NEXT: unreachable35 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: unreachable40