]> granicus.if.org Git - clang/commitdiff
Change CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum instead...
authorAnders Carlsson <andersca@mac.com>
Sat, 29 Jan 2011 20:24:48 +0000 (20:24 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 29 Jan 2011 20:24:48 +0000 (20:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124546 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGRTTI.cpp
lib/CodeGen/CGVTT.cpp
lib/CodeGen/CGVTables.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h

index 244bca8095ec59f4d4196e1a85998d1453d740b7..8ce465c59ac3f1717a3fc2e12c8d841cd8975632 100644 (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)) {
index fd8f576a0441dfcccb4bb7e01b47a452b0622716..604e4cb77366d80f2a9b90e4fd9a08d6124f595c 100644 (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) {
index a3c39a8fef6fb89cf551a73a11300542c8098ae6..c189e1d8ed3ad0d11b2ac2f5fdc807fd68343b96 100644 (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 *
index 66ac9fac5c9861dbff06bb58d10a0e0e355a9980..88de91afec73ecc789bec090a13ec74b39884316 100644 (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);
index a56866ad55ee3f1a2f42ce12a23caeef0d7bfc10..8e29869f8f989ec91321b4f3a289d6c0bcee95dd 100644 (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()))