[llvm-commits] [llvm] r54897 - /llvm/trunk/lib/VMCore/AsmWriter.cpp
Chris Lattner
sabre at nondot.org
Sun Aug 17 10:28:37 PDT 2008
Author: lattner
Date: Sun Aug 17 12:28:37 2008
New Revision: 54897
URL: http://llvm.org/viewvc/llvm-project?rev=54897&view=rev
Log:
getLLVMName is only used for types now, which always pass in LocalPrefix. Specialize on it.
Modified:
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=54897&r1=54896&r2=54897&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sun Aug 17 12:28:37 2008
@@ -193,25 +193,20 @@
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 @@
!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 @@
// 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
More information about the llvm-commits
mailing list