Set unnamed_addr in every type info.

llvm-svn: 123293
This commit is contained in:
Rafael Espindola 2011-01-11 23:55:05 +00:00
parent 1f7bc0707d
commit 25f4620c67
8 changed files with 106 additions and 108 deletions

View File

@ -642,11 +642,9 @@ llvm::Constant *RTTIBuilder::BuildTypeInfo(QualType Ty, bool Force) {
(CGM.getCodeGenOpts().HiddenWeakVTables &&
Linkage == llvm::GlobalValue::WeakODRLinkage)) {
GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
// FIXME: Should we set this for all type infos?
GV->setUnnamedAddr(true);
}
GV->setUnnamedAddr(true);
return llvm::ConstantExpr::getBitCast(GV, Int8PtrTy);
}

View File

@ -1,10 +1,10 @@
// RUN: %clang_cc1 -fno-rtti -fexceptions %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// CHECK: @_ZTIN5test11AE = weak_odr constant
// CHECK: @_ZTIN5test11BE = weak_odr constant
// CHECK: @_ZTIN5test11CE = weak_odr constant
// CHECK: @_ZTIN5test11DE = weak_odr constant
// CHECK: @_ZTIPN5test11DE = weak_odr constant {{.*}} @_ZTIN5test11DE
// CHECK: @_ZTIN5test11AE = weak_odr unnamed_addr constant
// CHECK: @_ZTIN5test11BE = weak_odr unnamed_addr constant
// CHECK: @_ZTIN5test11CE = weak_odr unnamed_addr constant
// CHECK: @_ZTIN5test11DE = weak_odr unnamed_addr constant
// CHECK: @_ZTIPN5test11DE = weak_odr unnamed_addr constant {{.*}} @_ZTIN5test11DE
// PR6974: this shouldn't crash
namespace test0 {

View File

@ -15,102 +15,102 @@ namespace __cxxabiv1 {
}
// void
// CHECK: @_ZTIv = constant
// CHECK: @_ZTIPv = constant
// CHECK: @_ZTIPKv = constant
// CHECK: @_ZTIv = unnamed_addr constant
// CHECK: @_ZTIPv = unnamed_addr constant
// CHECK: @_ZTIPKv = unnamed_addr constant
// std::nullptr_t
// CHECK: @_ZTIDn = constant
// CHECK: @_ZTIPDn = constant
// CHECK: @_ZTIPKDn = constant
// CHECK: @_ZTIDn = unnamed_addr constant
// CHECK: @_ZTIPDn = unnamed_addr constant
// CHECK: @_ZTIPKDn = unnamed_addr constant
// bool
// CHECK: @_ZTIb = constant
// CHECK: @_ZTIPb = constant
// CHECK: @_ZTIPKb = constant
// CHECK: @_ZTIb = unnamed_addr constant
// CHECK: @_ZTIPb = unnamed_addr constant
// CHECK: @_ZTIPKb = unnamed_addr constant
// wchar_t
// CHECK: @_ZTIw = constant
// CHECK: @_ZTIPw = constant
// CHECK: @_ZTIPKw = constant
// CHECK: @_ZTIw = unnamed_addr constant
// CHECK: @_ZTIPw = unnamed_addr constant
// CHECK: @_ZTIPKw = unnamed_addr constant
// char
// CHECK: @_ZTIc = constant
// CHECK: @_ZTIPc = constant
// CHECK: @_ZTIPKc = constant
// CHECK: @_ZTIc = unnamed_addr constant
// CHECK: @_ZTIPc = unnamed_addr constant
// CHECK: @_ZTIPKc = unnamed_addr constant
// unsigned char
// CHECK: @_ZTIh = constant
// CHECK: @_ZTIPh = constant
// CHECK: @_ZTIPKh = constant
// CHECK: @_ZTIh = unnamed_addr constant
// CHECK: @_ZTIPh = unnamed_addr constant
// CHECK: @_ZTIPKh = unnamed_addr constant
// signed char
// CHECK: @_ZTIa = constant
// CHECK: @_ZTIPa = constant
// CHECK: @_ZTIPKa = constant
// CHECK: @_ZTIa = unnamed_addr constant
// CHECK: @_ZTIPa = unnamed_addr constant
// CHECK: @_ZTIPKa = unnamed_addr constant
// short
// CHECK: @_ZTIs = constant
// CHECK: @_ZTIPs = constant
// CHECK: @_ZTIPKs = constant
// CHECK: @_ZTIs = unnamed_addr constant
// CHECK: @_ZTIPs = unnamed_addr constant
// CHECK: @_ZTIPKs = unnamed_addr constant
// unsigned short
// CHECK: @_ZTIt = constant
// CHECK: @_ZTIPt = constant
// CHECK: @_ZTIPKt = constant
// CHECK: @_ZTIt = unnamed_addr constant
// CHECK: @_ZTIPt = unnamed_addr constant
// CHECK: @_ZTIPKt = unnamed_addr constant
// int
// CHECK: @_ZTIi = constant
// CHECK: @_ZTIPi = constant
// CHECK: @_ZTIPKi = constant
// CHECK: @_ZTIi = unnamed_addr constant
// CHECK: @_ZTIPi = unnamed_addr constant
// CHECK: @_ZTIPKi = unnamed_addr constant
// unsigned int
// CHECK: @_ZTIj = constant
// CHECK: @_ZTIPj = constant
// CHECK: @_ZTIPKj = constant
// CHECK: @_ZTIj = unnamed_addr constant
// CHECK: @_ZTIPj = unnamed_addr constant
// CHECK: @_ZTIPKj = unnamed_addr constant
// long
// CHECK: @_ZTIl = constant
// CHECK: @_ZTIPl = constant
// CHECK: @_ZTIPKl = constant
// CHECK: @_ZTIl = unnamed_addr constant
// CHECK: @_ZTIPl = unnamed_addr constant
// CHECK: @_ZTIPKl = unnamed_addr constant
// unsigned long
// CHECK: @_ZTIm = constant
// CHECK: @_ZTIPm = constant
// CHECK: @_ZTIPKm = constant
// CHECK: @_ZTIm = unnamed_addr constant
// CHECK: @_ZTIPm = unnamed_addr constant
// CHECK: @_ZTIPKm = unnamed_addr constant
// long long
// CHECK: @_ZTIx = constant
// CHECK: @_ZTIPx = constant
// CHECK: @_ZTIPKx = constant
// CHECK: @_ZTIx = unnamed_addr constant
// CHECK: @_ZTIPx = unnamed_addr constant
// CHECK: @_ZTIPKx = unnamed_addr constant
// unsigned long long
// CHECK: @_ZTIy = constant
// CHECK: @_ZTIPy = constant
// CHECK: @_ZTIPKy = constant
// CHECK: @_ZTIy = unnamed_addr constant
// CHECK: @_ZTIPy = unnamed_addr constant
// CHECK: @_ZTIPKy = unnamed_addr constant
// float
// CHECK: @_ZTIf = constant
// CHECK: @_ZTIPf = constant
// CHECK: @_ZTIPKf = constant
// CHECK: @_ZTIf = unnamed_addr constant
// CHECK: @_ZTIPf = unnamed_addr constant
// CHECK: @_ZTIPKf = unnamed_addr constant
// double
// CHECK: @_ZTId = constant
// CHECK: @_ZTIPd = constant
// CHECK: @_ZTIPKd = constant
// CHECK: @_ZTId = unnamed_addr constant
// CHECK: @_ZTIPd = unnamed_addr constant
// CHECK: @_ZTIPKd = unnamed_addr constant
// long double
// CHECK: @_ZTIe = constant
// CHECK: @_ZTIPe = constant
// CHECK: @_ZTIPKe = constant
// CHECK: @_ZTIe = unnamed_addr constant
// CHECK: @_ZTIPe = unnamed_addr constant
// CHECK: @_ZTIPKe = unnamed_addr constant
// char16_t
// CHECK: @_ZTIDs = constant
// CHECK: @_ZTIPDs = constant
// CHECK: @_ZTIPKDs = constant
// CHECK: @_ZTIDs = unnamed_addr constant
// CHECK: @_ZTIPDs = unnamed_addr constant
// CHECK: @_ZTIPKDs = unnamed_addr constant
// char32_t
// CHECK: @_ZTIDi = constant
// CHECK: @_ZTIPDi = constant
// CHECK: @_ZTIPKDi = constant
// CHECK: @_ZTIDi = unnamed_addr constant
// CHECK: @_ZTIPDi = unnamed_addr constant
// CHECK: @_ZTIPKDi = unnamed_addr constant

View File

@ -6,50 +6,50 @@
// CHECK-WITH-HIDDEN: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
// CHECK-WITH-HIDDEN: @_ZTSPK2T4 = weak_odr hidden constant
// CHECK-WITH-HIDDEN: @_ZTS2T4 = weak_odr hidden constant
// CHECK-WITH-HIDDEN: @_ZTI2T4 = weak_odr hidden constant
// CHECK-WITH-HIDDEN: @_ZTI2T4 = weak_odr hidden unnamed_addr constant
// CHECK-WITH-HIDDEN: @_ZTIPK2T4 = weak_odr hidden unnamed_addr constant
// CHECK: _ZTSP1C = internal constant
// CHECK: _ZTS1C = internal constant
// CHECK: _ZTI1C = internal constant
// CHECK: _ZTIP1C = internal constant
// CHECK: _ZTI1C = internal unnamed_addr constant
// CHECK: _ZTIP1C = internal unnamed_addr constant
// CHECK: _ZTSPP1C = internal constant
// CHECK: _ZTIPP1C = internal constant
// CHECK: _ZTIPP1C = internal unnamed_addr constant
// CHECK: _ZTSM1Ci = internal constant
// CHECK: _ZTIM1Ci = internal constant
// CHECK: _ZTIM1Ci = internal unnamed_addr constant
// CHECK: _ZTSPM1Ci = internal constant
// CHECK: _ZTIPM1Ci = internal constant
// CHECK: _ZTIPM1Ci = internal unnamed_addr constant
// CHECK: _ZTSM1CS_ = internal constant
// CHECK: _ZTIM1CS_ = internal constant
// CHECK: _ZTIM1CS_ = internal unnamed_addr constant
// CHECK: _ZTSM1CPS_ = internal constant
// CHECK: _ZTIM1CPS_ = internal constant
// CHECK: _ZTIM1CPS_ = internal unnamed_addr constant
// CHECK: _ZTSM1A1C = internal constant
// CHECK: _ZTS1A = weak_odr constant
// CHECK: _ZTI1A = weak_odr hidden unnamed_addr constant
// CHECK: _ZTIM1A1C = internal constant
// CHECK: _ZTIM1A1C = internal unnamed_addr constant
// CHECK: _ZTSM1AP1C = internal constant
// CHECK: _ZTIM1AP1C = internal constant
// CHECK: _ZTIM1AP1C = internal unnamed_addr constant
// CHECK: _ZTSN12_GLOBAL__N_11DE = internal constant
// CHECK: _ZTIN12_GLOBAL__N_11DE = internal constant
// CHECK: _ZTIN12_GLOBAL__N_11DE = internal unnamed_addr constant
// CHECK: _ZTSPN12_GLOBAL__N_11DE = internal constant
// CHECK: _ZTIPN12_GLOBAL__N_11DE = internal constant
// CHECK: _ZTIPN12_GLOBAL__N_11DE = internal unnamed_addr constant
// CHECK: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal constant
// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal unnamed_addr constant
// CHECK: _ZTSFvN12_GLOBAL__N_11DEE = internal constant
// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal constant
// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal unnamed_addr constant
// CHECK: _ZTSPFvvE = weak_odr constant
// CHECK: _ZTSFvvE = weak_odr constant
// CHECK: _ZTIFvvE = weak_odr hidden unnamed_addr constant
// CHECK: _ZTIPFvvE = weak_odr hidden unnamed_addr constant
// CHECK: _ZTSN12_GLOBAL__N_11EE = internal constant
// CHECK: _ZTIN12_GLOBAL__N_11EE = internal constant
// CHECK: _ZTIN12_GLOBAL__N_11EE = internal unnamed_addr constant
// CHECK: _ZTSA10_i = weak_odr constant
// CHECK: _ZTIA10_i = weak_odr hidden unnamed_addr constant
// CHECK: _ZTI1TILj0EE = weak_odr constant
// CHECK: _ZTI1TILj1EE = weak_odr constant
// CHECK: _ZTI1TILj0EE = weak_odr unnamed_addr constant
// CHECK: _ZTI1TILj1EE = weak_odr unnamed_addr constant
// CHECK: _ZTI1TILj2EE = external constant
// CHECK: _ZTS1B = constant
// CHECK: _ZTI1B = constant
// CHECK: _ZTI1B = unnamed_addr constant
// CHECK: _ZTS1F = weak_odr constant
// CHECK: _ZTIN12_GLOBAL__N_11DE to

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// CHECK: @_ZTI3foo = constant
// CHECK: @_ZTI3foo = unnamed_addr constant
class foo {
foo();
virtual ~foo();

View File

@ -105,7 +105,7 @@ void use_F() {
// and hidden visibility (rdar://problem/7523229).
// CHECK-2: @_ZTV1C = weak_odr unnamed_addr constant
// CHECK-2: @_ZTS1C = weak_odr constant
// CHECK-2: @_ZTI1C = weak_odr constant
// CHECK-2: @_ZTI1C = weak_odr unnamed_addr constant
// CHECK-2-HIDDEN: @_ZTV1C = weak_odr hidden unnamed_addr constant
// CHECK-2-HIDDEN: @_ZTS1C = weak_odr constant
// CHECK-2-HIDDEN: @_ZTI1C = weak_odr hidden unnamed_addr constant
@ -114,46 +114,46 @@ void use_F() {
// defined in the translation unit.
// CHECK-3: @_ZTV1D = unnamed_addr constant
// CHECK-3: @_ZTS1D = constant
// CHECK-3: @_ZTI1D = constant
// CHECK-3: @_ZTI1D = unnamed_addr constant
// E<char> is an explicit specialization with a key function defined
// in this translation unit, so its vtable should have external
// linkage.
// CHECK-4: @_ZTV1EIcE = unnamed_addr constant
// CHECK-4: @_ZTS1EIcE = constant
// CHECK-4: @_ZTI1EIcE = constant
// CHECK-4: @_ZTI1EIcE = unnamed_addr constant
// E<short> is an explicit template instantiation with a key function
// defined in this translation unit, so its vtable should have
// weak_odr linkage.
// CHECK-5: @_ZTV1EIsE = weak_odr unnamed_addr constant
// CHECK-5: @_ZTS1EIsE = weak_odr constant
// CHECK-5: @_ZTI1EIsE = weak_odr constant
// CHECK-5: @_ZTI1EIsE = weak_odr unnamed_addr constant
// CHECK-5-HIDDEN: @_ZTV1EIsE = weak_odr unnamed_addr constant
// CHECK-5-HIDDEN: @_ZTS1EIsE = weak_odr constant
// CHECK-5-HIDDEN: @_ZTI1EIsE = weak_odr constant
// CHECK-5-HIDDEN: @_ZTI1EIsE = weak_odr unnamed_addr constant
// F<short> is an explicit template instantiation without a key
// function, so its vtable should have weak_odr linkage
// CHECK-6: @_ZTV1FIsE = weak_odr unnamed_addr constant
// CHECK-6: @_ZTS1FIsE = weak_odr constant
// CHECK-6: @_ZTI1FIsE = weak_odr constant
// CHECK-6: @_ZTI1FIsE = weak_odr unnamed_addr constant
// CHECK-6-HIDDEN: @_ZTV1FIsE = weak_odr unnamed_addr constant
// CHECK-6-HIDDEN: @_ZTS1FIsE = weak_odr constant
// CHECK-6-HIDDEN: @_ZTI1FIsE = weak_odr constant
// CHECK-6-HIDDEN: @_ZTI1FIsE = weak_odr unnamed_addr constant
// E<long> is an implicit template instantiation with a key function
// defined in this translation unit, so its vtable should have
// weak_odr linkage.
// CHECK-7: @_ZTV1EIlE = weak_odr unnamed_addr constant
// CHECK-7: @_ZTS1EIlE = weak_odr constant
// CHECK-7: @_ZTI1EIlE = weak_odr constant
// CHECK-7: @_ZTI1EIlE = weak_odr unnamed_addr constant
// F<long> is an implicit template instantiation with no key function,
// so its vtable should have weak_odr linkage.
// CHECK-8: @_ZTV1FIlE = weak_odr unnamed_addr constant
// CHECK-8: @_ZTS1FIlE = weak_odr constant
// CHECK-8: @_ZTI1FIlE = weak_odr constant
// CHECK-8: @_ZTI1FIlE = weak_odr unnamed_addr constant
// F<int> is an explicit template instantiation declaration without a
// key function, so its vtable should have external linkage.
@ -168,19 +168,19 @@ void use_F() {
// internal linkage.
// CHECK-11: @"_ZTV3$_0" = internal unnamed_addr constant
// CHECK-11: @"_ZTS3$_0" = internal constant
// CHECK-11: @"_ZTI3$_0" = internal constant
// CHECK-11: @"_ZTI3$_0" = internal unnamed_addr constant
// The A vtable should have internal linkage since it is inside an anonymous
// namespace.
// CHECK-12: @_ZTVN12_GLOBAL__N_11AE = internal unnamed_addr constant
// CHECK-12: @_ZTSN12_GLOBAL__N_11AE = internal constant
// CHECK-12: @_ZTIN12_GLOBAL__N_11AE = internal constant
// CHECK-12: @_ZTIN12_GLOBAL__N_11AE = internal unnamed_addr constant
// F<char> is an explicit specialization without a key function, so
// its vtable should have weak_odr linkage.
// CHECK-13: @_ZTV1FIcE = weak_odr unnamed_addr constant
// CHECK-13: @_ZTS1FIcE = weak_odr constant
// CHECK-13: @_ZTI1FIcE = weak_odr constant
// CHECK-13: @_ZTI1FIcE = weak_odr unnamed_addr constant
// RUN: FileCheck --check-prefix=CHECK-G %s < %t
//

View File

@ -4,19 +4,19 @@
namespace std { class type_info; }
// CHECK: @_ZTI1A = weak_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS1A
// CHECK: @_ZTI1A = weak_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS1A
@interface A
@end
// CHECK: @_ZTI1B = weak_odr constant {{.*}}@_ZTVN10__cxxabiv120__si_class_type_infoE{{.*}}@_ZTS1B{{.*}}@_ZTI1A
// CHECK: @_ZTI1B = weak_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv120__si_class_type_infoE{{.*}}@_ZTS1B{{.*}}@_ZTI1A
@interface B : A
@end
// CHECK: @_ZTIP1B = weak_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP1B{{.*}}), i32 0, {{.*}}@_ZTI1B
// CHECK: @_ZTI11objc_object = weak_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS11objc_object
// CHECK: @_ZTIP11objc_object = weak_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP11objc_object{{.*}}@_ZTI11objc_object
// CHECK: @_ZTI10objc_class = weak_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS10objc_class
// CHECK: @_ZTIP10objc_class = weak_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP10objc_class{{.*}}@_ZTI10objc_class
// CHECK: @_ZTIP1B = weak_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP1B{{.*}}), i32 0, {{.*}}@_ZTI1B
// CHECK: @_ZTI11objc_object = weak_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS11objc_object
// CHECK: @_ZTIP11objc_object = weak_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP11objc_object{{.*}}@_ZTI11objc_object
// CHECK: @_ZTI10objc_class = weak_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS10objc_class
// CHECK: @_ZTIP10objc_class = weak_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP10objc_class{{.*}}@_ZTI10objc_class
@protocol P;

View File

@ -7,6 +7,6 @@ struct X { };
void f() {
// CHECK: @_ZTS1X = weak_odr constant
// CHECK: @_ZTI1X = weak_odr constant
// CHECK: @_ZTI1X = weak_odr unnamed_addr constant
(void)typeid(X&);
}