summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit836100626452e656a893142c11e90353dcfd321e (patch)
treef395cf6bc74a4e37786f53afe9586daf29c58376 /llvm/lib/MC/MCSymbol.cpp
parentb34888b6d043903071a41a38fcad536acea18c8c (diff)
downloadbcm5719-llvm-836100626452e656a893142c11e90353dcfd321e.tar.gz
bcm5719-llvm-836100626452e656a893142c11e90353dcfd321e.zip
expose a static function as a static method on the MCSymbol class.
llvm-svn: 93350
Diffstat (limited to 'llvm/lib/MC/MCSymbol.cpp')
-rw-r--r--llvm/lib/MC/MCSymbol.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp
index 83200a0bb9f..265d06cceba 100644
--- a/llvm/lib/MC/MCSymbol.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud