[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCXX / typeid-with-address-space.cpp
blobb439770a8b631e8081182b9ce2c49feb28685a05
1 // RUN: %clang_cc1 -I%S %s -triple amdgcn-amd-amdhsa -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s
2 #include <typeinfo>
4 namespace Test1 {
6 // PR7400
7 struct A { virtual void f(); };
9 // CHECK: @_ZN5Test16int_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIi to ptr), align 8
10 const std::type_info &int_ti = typeid(int);
12 // CHECK: @_ZN5Test14A_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIN5Test11AE to ptr), align 8
13 const std::type_info &A_ti = typeid(const volatile A &);
15 volatile char c;
17 // CHECK: @_ZN5Test14c_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIc to ptr), align 8
18 const std::type_info &c_ti = typeid(c);
20 extern const double &d;
22 // CHECK: @_ZN5Test14d_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTId to ptr), align 8
23 const std::type_info &d_ti = typeid(d);
25 extern A &a;
27 // CHECK: @_ZN5Test14a_tiE ={{.*}} global
28 const std::type_info &a_ti = typeid(a);
30 // CHECK: @_ZN5Test18A10_c_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIA10_c to ptr), align 8
31 const std::type_info &A10_c_ti = typeid(char const[10]);
33 // CHECK-LABEL: define{{.*}} ptr @_ZN5Test11fEv
34 // CHECK-SAME: personality ptr @__gxx_personality_v0
35 const char *f() {
36 try {
37 // CHECK: br i1
38 // 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 null
45 return 0;
50 // CHECK: attributes [[NR]] = { noreturn }