diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-12-10 05:41:10 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-12-10 05:41:10 +0000 |
commit | 9913e596782bf9c0f1f31bf397ccc0ddfa967deb (patch) | |
tree | 4f52fbb8af5bf4e773b0a9aa1af71eb22ee39478 /lib/VMCore/AsmWriter.cpp | |
parent | d82ef51187ccb9986295ac4ce075ffc97ea92f85 (diff) | |
download | external_llvm-9913e596782bf9c0f1f31bf397ccc0ddfa967deb.zip external_llvm-9913e596782bf9c0f1f31bf397ccc0ddfa967deb.tar.gz external_llvm-9913e596782bf9c0f1f31bf397ccc0ddfa967deb.tar.bz2 |
Fix writer to properly quote label names when they don't contain
simple characters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index dde6b9d..945f0b5 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -203,7 +203,8 @@ static SlotMachine *createSlotMachine(const Value *V) { // 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) { +static std::string getLLVMName(const std::string &Name, + bool prefixName = true) { assert(!Name.empty() && "Cannot get empty name!"); // First character cannot start with a number... @@ -220,7 +221,10 @@ static std::string getLLVMName(const std::string &Name) { } // If we get here, then the identifier is legal to use as a "VarID". - return "%"+Name; + if (prefixName) + return "%"+Name; + else + return Name; } @@ -953,7 +957,7 @@ void AssemblyWriter::printArgument(const Argument *Arg) { /// void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { if (BB->hasName()) { // Print out the label if it exists... - Out << "\n" << BB->getName() << ':'; + Out << "\n" << getLLVMName(BB->getName(), false) << ':'; } else if (!BB->use_empty()) { // Don't print block # of no uses... Out << "\n; <label>:"; int Slot = Machine.getSlot(BB); |