blob: 326760fa6f0952caef3e790b8088c422193cd026 [file] [log] [blame]
John McCall398dc372010-08-12 02:17:33 +00001// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2
3// PR7864. This all follows GCC's lead.
4
5namespace std { class type_info; }
6
John McCall57420b32014-02-08 03:26:05 +00007// CHECK: @_ZTI1A = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS1A
John McCall398dc372010-08-12 02:17:33 +00008@interface A
9@end
10
John McCall57420b32014-02-08 03:26:05 +000011// CHECK: @_ZTI1B = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv120__si_class_type_infoE{{.*}}@_ZTS1B{{.*}}@_ZTI1A
John McCall398dc372010-08-12 02:17:33 +000012@interface B : A
13@end
14
John McCall57420b32014-02-08 03:26:05 +000015// CHECK: @_ZTIP1B = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP1B{{.*}}), i32 0, {{.*}}@_ZTI1B
16// CHECK: @_ZTI11objc_object = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS11objc_object
17// CHECK: @_ZTIP11objc_object = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP11objc_object{{.*}}@_ZTI11objc_object
18// CHECK: @_ZTI10objc_class = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS10objc_class
19// CHECK: @_ZTIP10objc_class = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP10objc_class{{.*}}@_ZTI10objc_class
John McCall398dc372010-08-12 02:17:33 +000020
21@protocol P;
22
23int main() {
24 // CHECK: store {{.*}} @_ZTIP1B
25 // CHECK: store {{.*}} @_ZTI1B
26 const std::type_info &t1 = typeid(B*);
27 const std::type_info &t2 = typeid(B);
28
29 // CHECK: store {{.*}} @_ZTIP11objc_object
30 // CHECK: store {{.*}} @_ZTI11objc_object
31 id i = 0;
32 const std::type_info &t3 = typeid(i);
33 const std::type_info &t4 = typeid(*i);
34
35 // CHECK: store {{.*}} @_ZTIP10objc_class
36 // CHECK: store {{.*}} @_ZTI10objc_class
37 Class c = 0;
38 const std::type_info &t5 = typeid(c);
39 const std::type_info &t6 = typeid(*c);
40
Eli Friedman5f508952013-06-18 22:41:37 +000041 // CHECK: store {{.*}} @_ZTIPU11objcproto1P11objc_object
42 // CHECK: store {{.*}} @_ZTIU11objcproto1P11objc_object
John McCall398dc372010-08-12 02:17:33 +000043 id<P> i2 = 0;
44 const std::type_info &t7 = typeid(i2);
45 const std::type_info &t8 = typeid(*i2);
46
Eli Friedman5f508952013-06-18 22:41:37 +000047 // CHECK: store {{.*}} @_ZTIPU11objcproto1P10objc_class
48 // CHECK: store {{.*}} @_ZTIU11objcproto1P10objc_class
John McCall398dc372010-08-12 02:17:33 +000049 Class<P> c2 = 0;
50 const std::type_info &t9 = typeid(c2);
51 const std::type_info &t10 = typeid(*c2);
52}