xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/rtti.mm (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambuc// PR7864.  This all follows GCC's lead.
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambucnamespace std { class type_info; }
6f4a2713aSLionel Sambuc
7*0a6a1f1dSLionel Sambuc// CHECK: @_ZTI1A = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS1A
8f4a2713aSLionel Sambuc@interface A
9f4a2713aSLionel Sambuc@end
10f4a2713aSLionel Sambuc
11*0a6a1f1dSLionel Sambuc// CHECK: @_ZTI1B = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv120__si_class_type_infoE{{.*}}@_ZTS1B{{.*}}@_ZTI1A
12f4a2713aSLionel Sambuc@interface B : A
13f4a2713aSLionel Sambuc@end
14f4a2713aSLionel Sambuc
15*0a6a1f1dSLionel Sambuc// CHECK: @_ZTIP1B = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP1B{{.*}}), i32 0, {{.*}}@_ZTI1B
16*0a6a1f1dSLionel Sambuc// CHECK: @_ZTI11objc_object = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS11objc_object
17*0a6a1f1dSLionel Sambuc// CHECK: @_ZTIP11objc_object = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP11objc_object{{.*}}@_ZTI11objc_object
18*0a6a1f1dSLionel Sambuc// CHECK: @_ZTI10objc_class = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS10objc_class
19*0a6a1f1dSLionel Sambuc// CHECK: @_ZTIP10objc_class = linkonce_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP10objc_class{{.*}}@_ZTI10objc_class
20f4a2713aSLionel Sambuc
21f4a2713aSLionel Sambuc@protocol P;
22f4a2713aSLionel Sambuc
23f4a2713aSLionel Sambucint main() {
24f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTIP1B
25f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTI1B
26f4a2713aSLionel Sambuc  const std::type_info &t1 = typeid(B*);
27f4a2713aSLionel Sambuc  const std::type_info &t2 = typeid(B);
28f4a2713aSLionel Sambuc
29f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTIP11objc_object
30f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTI11objc_object
31f4a2713aSLionel Sambuc  id i = 0;
32f4a2713aSLionel Sambuc  const std::type_info &t3 = typeid(i);
33f4a2713aSLionel Sambuc  const std::type_info &t4 = typeid(*i);
34f4a2713aSLionel Sambuc
35f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTIP10objc_class
36f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTI10objc_class
37f4a2713aSLionel Sambuc  Class c = 0;
38f4a2713aSLionel Sambuc  const std::type_info &t5 = typeid(c);
39f4a2713aSLionel Sambuc  const std::type_info &t6 = typeid(*c);
40f4a2713aSLionel Sambuc
41f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTIPU11objcproto1P11objc_object
42f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTIU11objcproto1P11objc_object
43f4a2713aSLionel Sambuc  id<P> i2 = 0;
44f4a2713aSLionel Sambuc  const std::type_info &t7 = typeid(i2);
45f4a2713aSLionel Sambuc  const std::type_info &t8 = typeid(*i2);
46f4a2713aSLionel Sambuc
47f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTIPU11objcproto1P10objc_class
48f4a2713aSLionel Sambuc  // CHECK: store {{.*}} @_ZTIU11objcproto1P10objc_class
49f4a2713aSLionel Sambuc  Class<P> c2 = 0;
50f4a2713aSLionel Sambuc  const std::type_info &t9 = typeid(c2);
51f4a2713aSLionel Sambuc  const std::type_info &t10 = typeid(*c2);
52f4a2713aSLionel Sambuc}
53