summaryrefslogtreecommitdiffstats
path: root/lib/MC/MCSymbol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MC/MCSymbol.cpp')
-rw-r--r--lib/MC/MCSymbol.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp
index b145d07..265d06c 100644
--- a/lib/MC/MCSymbol.cpp
+++ b/lib/MC/MCSymbol.cpp
@@ -9,6 +9,7 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -51,11 +52,14 @@ static bool NameNeedsEscaping(StringRef Str, const MCAsmInfo &MAI) {
return false;
}
-static void PrintMangledName(raw_ostream &OS, StringRef Str,
- const MCAsmInfo &MAI) {
+/// printMangledName - Print the specified string in mangled form if it uses
+/// any unusual characters.
+void MCSymbol::printMangledName(StringRef Str, raw_ostream &OS,
+ const MCAsmInfo *MAI) {
// The first character is not allowed to be a number unless the target
// explicitly allows it.
- if (!MAI.doesAllowNameToStartWithDigit() && Str[0] >= '0' && Str[0] <= '9') {
+ if ((MAI == 0 || !MAI->doesAllowNameToStartWithDigit()) &&
+ Str[0] >= '0' && Str[0] <= '9') {
MangleLetter(OS, Str[0]);
Str = Str.substr(1);
}
@@ -94,7 +98,7 @@ void MCSymbol::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
// On systems that do not allow quoted names, print with mangling.
if (!MAI->doesAllowQuotesInName())
- return PrintMangledName(OS, getName(), *MAI);
+ return printMangledName(getName(), OS, MAI);
// If the string contains a double quote or newline, we still have to mangle
// it.
@@ -106,5 +110,5 @@ void MCSymbol::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
}
void MCSymbol::dump() const {
- print(errs(), 0);
+ print(dbgs(), 0);
}
OpenPOWER on IntegriCloud