summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-08-17 17:28:37 +0000
committerChris Lattner <sabre@nondot.org>2008-08-17 17:28:37 +0000
commitaddd44427cb1b46d85f2eb31c267dd1d43914252 (patch)
tree99cd0f7f735a6c652baaeb05ee466a373b0dcd11 /lib/VMCore
parent9225507cda6c634ded5054f44a75835a0c8cf62a (diff)
downloadllvm-addd44427cb1b46d85f2eb31c267dd1d43914252.tar.gz
llvm-addd44427cb1b46d85f2eb31c267dd1d43914252.tar.bz2
llvm-addd44427cb1b46d85f2eb31c267dd1d43914252.tar.xz
getLLVMName is only used for types now, which always pass in LocalPrefix. Specialize on it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54897 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 87d0da5b8f..282f47bec1 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -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