getLLVMName is only used for types now, which always pass in LocalPrefix. Specialize...
authorChris Lattner <sabre@nondot.org>
Sun, 17 Aug 2008 17:28:37 +0000 (17:28 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 17 Aug 2008 17:28:37 +0000 (17:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54897 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index 87d0da5b8ff2f098f4c70e56c667eef1e7548ffb..282f47bec15053b593dd0ea63c5cc60eb3c0cf17 100644 (file)
@@ -193,25 +193,20 @@ static std::string QuoteNameIfNeeded(const std::string &Name) {
   return result;
 }
 
-enum PrefixType {
-  GlobalPrefix,
-  LabelPrefix,
-  LocalPrefix
-};
-
 /// getLLVMName - Turn the specified string into an 'LLVM name', which is either
 /// prefixed with % (if the string only contains simple characters) or is
 /// surrounded with ""'s (if it has special chars in it).
-static std::string getLLVMName(const std::string &Name, PrefixType Prefix) {
+static std::string getLLVMName(const std::string &Name) {
   assert(!Name.empty() && "Cannot get empty name!");
-  switch (Prefix) {
-  default: assert(0 && "Bad prefix!");
-  case GlobalPrefix: return '@' + QuoteNameIfNeeded(Name);
-  case LabelPrefix:  return QuoteNameIfNeeded(Name);
-  case LocalPrefix:  return '%' + QuoteNameIfNeeded(Name);
-  }      
+  return '%' + QuoteNameIfNeeded(Name);
 }
 
+enum PrefixType {
+  GlobalPrefix,
+  LabelPrefix,
+  LocalPrefix
+};
+
 /// PrintLLVMName - Turn the specified name into an 'LLVM name', which is either
 /// prefixed with % (if the string only contains simple characters) or is
 /// surrounded with ""'s (if it has special chars in it).  Print it out.
@@ -296,7 +291,7 @@ static void fillTypeNameTable(const Module *M,
         !cast<PointerType>(Ty)->getElementType()->isPrimitiveType() ||
         !cast<PointerType>(Ty)->getElementType()->isInteger() ||
         isa<OpaqueType>(cast<PointerType>(Ty)->getElementType()))
-      TypeNames.insert(std::make_pair(Ty, getLLVMName(TI->first, LocalPrefix)));
+      TypeNames.insert(std::make_pair(Ty, getLLVMName(TI->first)));
   }
 }
 
@@ -1085,7 +1080,7 @@ void AssemblyWriter::printTypeSymbolTable(const TypeSymbolTable &ST) {
   // Print the types.
   for (TypeSymbolTable::const_iterator TI = ST.begin(), TE = ST.end();
        TI != TE; ++TI) {
-    Out << "\t" << getLLVMName(TI->first, LocalPrefix) << " = type ";
+    Out << "\t" << getLLVMName(TI->first) << " = type ";
 
     // Make sure we print out at least one level of the type structure, so
     // that we do not get %FILE = type %FILE