aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCSymbol.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-13 21:09:59 +0000
committerChris Lattner <sabre@nondot.org>2010-01-13 21:09:59 +0000
commit4564ec9ca7a01cea24b6491ffd90268bf2aa509c (patch)
tree44e65c866c753070d5c1eb6a20074c64a87ba585 /lib/MC/MCSymbol.cpp
parent12360917ef08364050ef134ed70c69136465eaba (diff)
expose a static function as a static method on the MCSymbol class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93350 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCSymbol.cpp')
-rw-r--r--lib/MC/MCSymbol.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp
index 83200a0bb9..265d06cceb 100644
--- a/lib/MC/MCSymbol.cpp
+++ b/lib/MC/MCSymbol.cpp
@@ -52,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);
}
@@ -95,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.