brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 0c6f036 Raw
51 lines · cpp
1// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s2#include <typeinfo>3 4namespace Test1 {5 6// PR74007struct A { virtual void f(); };8 9// CHECK: @_ZN5Test16int_tiE ={{.*}} constant ptr @_ZTIi, align 810const std::type_info &int_ti = typeid(int);11 12// CHECK: @_ZN5Test14A_tiE ={{.*}} constant ptr @_ZTIN5Test11AE, align 813const std::type_info &A_ti = typeid(const volatile A &);14 15volatile char c;16 17// CHECK: @_ZN5Test14c_tiE ={{.*}} constant ptr @_ZTIc, align 818const std::type_info &c_ti = typeid(c);19 20extern const double &d;21 22// CHECK: @_ZN5Test14d_tiE ={{.*}} constant ptr @_ZTId, align 823const std::type_info &d_ti = typeid(d);24 25extern A &a;26 27// CHECK: @_ZN5Test14a_tiE ={{.*}} global28const std::type_info &a_ti = typeid(a);29 30// CHECK: @_ZN5Test18A10_c_tiE ={{.*}} constant ptr @_ZTIA10_c, align 831const std::type_info &A10_c_ti = typeid(char const[10]);32 33// CHECK-LABEL: define{{.*}} ptr @_ZN5Test11fEv34// CHECK-SAME:  personality ptr @__gxx_personality_v035const char *f() {36  try {37    // CHECK: br i138    // CHECK: invoke void @__cxa_bad_typeid() [[NR:#[0-9]+]]39    return typeid(*static_cast<A *>(0)).name();40  } catch (...) {41    // CHECK:      landingpad { ptr, i32 }42    // CHECK-NEXT:   catch ptr null43  }44 45  return 0;46}47 48}49 50// CHECK: attributes [[NR]] = { noreturn }51