Anders Carlsson | 8d14515 | 2009-12-20 22:30:54 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s |
| 2 | #include <typeinfo> |
Anders Carlsson | 4e71356 | 2009-12-11 16:37:06 +0000 | [diff] [blame] | 3 | |
| 4 | // CHECK: _ZTS1B = constant |
| 5 | // CHECK: _ZTS1A = weak_odr constant |
| 6 | // CHECK: _ZTI1A = weak_odr constant |
| 7 | // CHECK: _ZTI1B = constant |
Anders Carlsson | 8d14515 | 2009-12-20 22:30:54 +0000 | [diff] [blame] | 8 | // CHECK: _ZTSP1C = internal constant |
| 9 | // CHECK: _ZTIP1C = internal constant |
| 10 | // CHECK: _ZTSPP1C = internal constant |
| 11 | // CHECK: _ZTIPP1C = internal constant |
Anders Carlsson | 17fa6f9 | 2009-12-20 23:37:55 +0000 | [diff] [blame^] | 12 | // CHECK: _ZTSM1Ci = internal constant |
| 13 | // CHECK: _ZTIM1Ci = internal constant |
| 14 | // CHECK: _ZTSPM1Ci = internal constant |
| 15 | // CHECK: _ZTIPM1Ci = internal constant |
| 16 | // CHECK: _ZTSM1CS_ = internal constant |
| 17 | // CHECK: _ZTIM1CS_ = internal constant |
| 18 | // CHECK: _ZTSM1CPS_ = internal constant |
| 19 | // CHECK: _ZTIM1CPS_ = internal constant |
| 20 | // CHECK: _ZTSM1A1C = internal constant |
| 21 | // CHECK: _ZTIM1A1C = internal constant |
| 22 | // CHECK: _ZTSM1AP1C = internal constant |
| 23 | // CHECK: _ZTIM1AP1C = internal constant |
| 24 | |
Anders Carlsson | 4e71356 | 2009-12-11 16:37:06 +0000 | [diff] [blame] | 25 | // A has no key function, so its RTTI data should be weak_odr. |
| 26 | struct A { }; |
| 27 | |
| 28 | // B has a key function defined in the translation unit, so the RTTI data should |
| 29 | // be emitted in this translation unit and have external linkage. |
| 30 | struct B : A { |
| 31 | virtual void f(); |
| 32 | }; |
| 33 | void B::f() { } |
Anders Carlsson | 8d14515 | 2009-12-20 22:30:54 +0000 | [diff] [blame] | 34 | |
| 35 | // C is an incomplete class type, so any direct or indirect pointer types should have |
| 36 | // internal linkage, as should the type info for C itself (FIXME). |
| 37 | struct C; |
| 38 | |
| 39 | void f() { |
| 40 | (void)typeid(C*); |
| 41 | (void)typeid(C**); |
Anders Carlsson | 17fa6f9 | 2009-12-20 23:37:55 +0000 | [diff] [blame^] | 42 | (void)typeid(int C::*); |
| 43 | (void)typeid(int C::**); |
| 44 | (void)typeid(C C::*); |
| 45 | (void)typeid(C *C::*); |
| 46 | (void)typeid(C A::*); |
| 47 | (void)typeid(C* A::*); |
Anders Carlsson | 8d14515 | 2009-12-20 22:30:54 +0000 | [diff] [blame] | 48 | |
| 49 | } |
| 50 | |