1 // RUN: %clang_cc1 -I%S %s -triple amdgcn-amd-amdhsa -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s
2 // RUN: %clang_cc1 -I%S %s -triple spirv64-amd-amdhsa -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s --check-prefix=WITH-NONZERO-DEFAULT-AS
8 struct A
{ virtual void f(); };
10 // CHECK: @_ZN5Test16int_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIi to ptr), align 8
11 // WITH-NONZERO-DEFAULT-AS: @_ZN5Test16int_tiE ={{.*}} constant ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTIi to ptr addrspace(4)), align 8
12 const std::type_info
&int_ti
= typeid(int);
14 // CHECK: @_ZN5Test14A_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIN5Test11AE to ptr), align 8
15 // WITH-NONZERO-DEFAULT-AS: @_ZN5Test14A_tiE ={{.*}} constant ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTIN5Test11AE to ptr addrspace(4)), align 8
16 const std::type_info
&A_ti
= typeid(const volatile A
&);
20 // CHECK: @_ZN5Test14c_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIc to ptr), align 8
21 // WITH-NONZERO-DEFAULT-AS: @_ZN5Test14c_tiE ={{.*}} constant ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTIc to ptr addrspace(4)), align 8
22 const std::type_info
&c_ti
= typeid(c
);
24 extern const double &d
;
26 // CHECK: @_ZN5Test14d_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTId to ptr), align 8
27 // WITH-NONZERO-DEFAULT-AS: @_ZN5Test14d_tiE ={{.*}} constant ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTId to ptr addrspace(4)), align 8
28 const std::type_info
&d_ti
= typeid(d
);
32 // CHECK: @_ZN5Test14a_tiE ={{.*}} global
33 const std::type_info
&a_ti
= typeid(a
);
35 // CHECK: @_ZN5Test18A10_c_tiE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIA10_c to ptr), align 8
36 // WITH-NONZERO-DEFAULT-AS: @_ZN5Test18A10_c_tiE ={{.*}} constant ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTIA10_c to ptr addrspace(4)), align 8
37 const std::type_info
&A10_c_ti
= typeid(char const[10]);
39 // CHECK-LABEL: define{{.*}} ptr @_ZN5Test11fEv
40 // CHECK-SAME: personality ptr @__gxx_personality_v0
41 // WITH-NONZERO-DEFAULT-AS-LABEL: define{{.*}} ptr addrspace(4) @_ZN5Test11fEv
42 // WITH-NONZERO-DEFAULT-AS-SAME: personality ptr addrspace(4) @__gxx_personality_v0
46 // CHECK: invoke void @__cxa_bad_typeid() [[NR:#[0-9]+]]
47 // WITH-NONZERO-DEFAULT-AS: invoke{{.*}} void @__cxa_bad_typeid() [[NR:#[0-9]+]]
48 return typeid(*static_cast<A
*>(0)).name();
50 // CHECK: landingpad { ptr, i32 }
51 // CHECK-NEXT: catch ptr null
52 // WITH-NONZERO-DEFAULT-AS: landingpad { ptr addrspace(4), i32 }
53 // WITH-NONZERO-DEFAULT-AS-NEXT: catch ptr addrspace(4) null
61 // CHECK: attributes [[NR]] = { noreturn }