add a version of AsmPrinter::printVisibility that takes an MCSymbol.
authorChris Lattner <sabre@nondot.org>
Fri, 15 Jan 2010 23:38:51 +0000 (23:38 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 15 Jan 2010 23:38:51 +0000 (23:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93587 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

index 19634cf943fcc64c633ab7cf65ac56b1eba86808..28f3e8bfa053fefee0ebb4d33837aff8bfa168d2 100644 (file)
@@ -418,6 +418,9 @@ namespace llvm {
 
     /// printVisibility - This prints visibility information about symbol, if
     /// this is suported by the target.
+    void printVisibility(const MCSymbol *Sym, unsigned Visibility) const;
+    
+    // FIXME: This is deprecated and should be removed.
     void printVisibility(const std::string& Name, unsigned Visibility) const;
 
     /// printOffset - This is just convenient handler for printing offsets.
index 013889b5b2a0ac92674353af6f4195ecd398ab40..7293ec0ba9e6285f6c37c41835b4e69a27ac34d3 100644 (file)
@@ -1856,6 +1856,23 @@ void AsmPrinter::printVisibility(const std::string& Name,
   }
 }
 
+void AsmPrinter::printVisibility(const MCSymbol *Sym,
+                                 unsigned Visibility) const {
+  if (Visibility == GlobalValue::HiddenVisibility) {
+    if (const char *Directive = MAI->getHiddenDirective()) {
+      O << Directive;
+      Sym->print(O, MAI);
+      O << '\n';
+    }
+  } else if (Visibility == GlobalValue::ProtectedVisibility) {
+    if (const char *Directive = MAI->getProtectedDirective()) {
+      O << Directive;
+      Sym->print(O, MAI);
+      O << '\n';
+    }
+  }
+}
+
 void AsmPrinter::printOffset(int64_t Offset) const {
   if (Offset > 0)
     O << '+' << Offset;
index 2f3dec42f877f806ea0964c540a60eeb7cf87bea..5c596880e419691c9ed88aa3f36f923c6ebe9d60 100644 (file)
@@ -49,7 +49,6 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormattedStream.h"
-#include "llvm/Support/Mangler.h"
 #include "llvm/Support/MathExtras.h"
 #include <cctype>
 using namespace llvm;
@@ -1186,9 +1185,7 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
     return;
   }
 
-  std::string Name = Mang->getMangledName(GVar);
   MCSymbol *GVarSym = GetGlobalValueSymbol(GVar);
-
   
   Constant *C = GVar->getInitializer();
   const Type *Type = C->getType();
@@ -1196,7 +1193,7 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
   unsigned Align = TD->getPreferredAlignmentLog(GVar);
   bool isDarwin = Subtarget->isTargetDarwin();
 
-  printVisibility(Name, GVar->getVisibility());
+  printVisibility(GVarSym, GVar->getVisibility());
 
   if (Subtarget->isTargetELF()) {
     O << "\t.type ";