Change CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum instead of an "IsForRTTI" flag.

llvm-svn: 124546
This commit is contained in:
Anders Carlsson 2011-01-29 20:24:48 +00:00
parent 326e4a2966
commit 265aa7c070
5 changed files with 16 additions and 6 deletions

View File

@ -644,7 +644,7 @@ llvm::Constant *RTTIBuilder::BuildTypeInfo(QualType Ty, bool Force) {
// compatibility.
if (const RecordType *RT = dyn_cast<RecordType>(Ty))
CGM.setTypeVisibility(GV, cast<CXXRecordDecl>(RT->getDecl()),
/*ForRTTI=*/true);
CodeGenModule::TVK_ForRTTI);
else if (Hidden ||
(CGM.getCodeGenOpts().HiddenWeakVTables &&
Linkage == llvm::GlobalValue::LinkOnceODRLinkage)) {

View File

@ -386,7 +386,7 @@ CodeGenVTables::EmitVTTDefinition(llvm::GlobalVariable *VTT,
VTT->setLinkage(Linkage);
// Set the right visibility.
CGM.setTypeVisibility(VTT, RD, /*ForRTTI=*/false);
CGM.setTypeVisibility(VTT, RD, CodeGenModule::TVK_ForVTT);
}
llvm::GlobalVariable *CodeGenVTables::GetAddrOfVTT(const CXXRecordDecl *RD) {

View File

@ -2976,7 +2976,7 @@ CodeGenVTables::EmitVTableDefinition(llvm::GlobalVariable *VTable,
VTable->setLinkage(Linkage);
// Set the right visibility.
CGM.setTypeVisibility(VTable, RD, /*ForRTTI=*/false);
CGM.setTypeVisibility(VTable, RD, CodeGenModule::TVK_ForVTable);
}
llvm::GlobalVariable *

View File

@ -193,7 +193,7 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV,
/// associated with the given type.
void CodeGenModule::setTypeVisibility(llvm::GlobalValue *GV,
const CXXRecordDecl *RD,
bool IsForRTTI) const {
TypeVisibilityKind TVK) const {
setGlobalVisibility(GV, RD);
if (!CodeGenOpts.HiddenWeakVTables)
@ -242,9 +242,10 @@ void CodeGenModule::setTypeVisibility(llvm::GlobalValue *GV,
// If there's a key function, there may be translation units
// that don't have the key function's definition. But ignore
// this if we're emitting RTTI under -fno-rtti.
if (!IsForRTTI || Features.RTTI)
if (!(TVK != TVK_ForRTTI) || Features.RTTI) {
if (Context.getKeyFunction(RD))
return;
}
// Otherwise, drop the visibility to hidden.
GV->setVisibility(llvm::GlobalValue::HiddenVisibility);

View File

@ -261,10 +261,19 @@ public:
/// GlobalValue.
void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const;
/// TypeVisibilityKind - The kind of global variable that is passed to
/// setTypeVisibility
enum TypeVisibilityKind {
TVK_ForVTT,
TVK_ForVTable,
TVK_ForRTTI,
TVK_ForRTTIName
};
/// setTypeVisibility - Set the visibility for the given global
/// value which holds information about a type.
void setTypeVisibility(llvm::GlobalValue *GV, const CXXRecordDecl *D,
bool IsForRTTI) const;
TypeVisibilityKind TVK) const;
llvm::Constant *GetAddrOfGlobal(GlobalDecl GD) {
if (isa<CXXConstructorDecl>(GD.getDecl()))