Set unnamed_addr for type infos that we are confortable marking as hidden. I

think it is safe to mark all type infos with unnamed_addr, but I am not sure.

llvm-svn: 123275
This commit is contained in:
Rafael Espindola 2011-01-11 21:44:37 +00:00
parent 447cb38fbe
commit b1e879c80f
4 changed files with 12 additions and 7 deletions

View File

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

View File

@ -251,6 +251,7 @@ void CodeGenModule::setTypeVisibility(llvm::GlobalValue *GV,
// Otherwise, drop the visibility to hidden.
GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
GV->setUnnamedAddr(true);
}
llvm::StringRef CodeGenModule::getMangledName(GlobalDecl GD) {

View File

@ -7,7 +7,7 @@
// 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: @_ZTIPK2T4 = weak_odr hidden constant
// CHECK-WITH-HIDDEN: @_ZTIPK2T4 = weak_odr hidden unnamed_addr constant
// CHECK: _ZTSP1C = internal constant
// CHECK: _ZTS1C = internal constant
@ -25,7 +25,7 @@
// CHECK: _ZTIM1CPS_ = internal constant
// CHECK: _ZTSM1A1C = internal constant
// CHECK: _ZTS1A = weak_odr constant
// CHECK: _ZTI1A = weak_odr hidden constant
// CHECK: _ZTI1A = weak_odr hidden unnamed_addr constant
// CHECK: _ZTIM1A1C = internal constant
// CHECK: _ZTSM1AP1C = internal constant
// CHECK: _ZTIM1AP1C = internal constant
@ -39,12 +39,12 @@
// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal constant
// CHECK: _ZTSPFvvE = weak_odr constant
// CHECK: _ZTSFvvE = weak_odr constant
// CHECK: _ZTIFvvE = weak_odr hidden constant
// CHECK: _ZTIPFvvE = weak_odr hidden 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: _ZTSA10_i = weak_odr constant
// CHECK: _ZTIA10_i = weak_odr hidden constant
// CHECK: _ZTIA10_i = weak_odr hidden unnamed_addr constant
// CHECK: _ZTI1TILj0EE = weak_odr constant
// CHECK: _ZTI1TILj1EE = weak_odr constant
// CHECK: _ZTI1TILj2EE = external constant

View File

@ -108,7 +108,7 @@ void use_F() {
// CHECK-2: @_ZTI1C = weak_odr 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 constant
// CHECK-2-HIDDEN: @_ZTI1C = weak_odr hidden unnamed_addr constant
// D has a key function that is defined in this translation unit so its vtable is
// defined in the translation unit.