OSDN Git Service

fix a couple problems I introduced handling symbols
authorChris Lattner <sabre@nondot.org>
Mon, 5 Apr 2010 16:32:14 +0000 (16:32 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 5 Apr 2010 16:32:14 +0000 (16:32 +0000)
with spaces in them.  Sym->getName()  !=   OS << *Sym

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100434 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

index 419af5d..8e855f5 100644 (file)
@@ -237,7 +237,7 @@ namespace {
       if (ACPV->isLSDA()) {
         O << MAI->getPrivateGlobalPrefix() << "_LSDA_" << getFunctionNumber();
       } else if (ACPV->isBlockAddress()) {
-        O << GetBlockAddressSymbol(ACPV->getBlockAddress())->getName();
+        O << *GetBlockAddressSymbol(ACPV->getBlockAddress());
       } else if (ACPV->isGlobalValue()) {
         GlobalValue *GV = ACPV->getGV();
         bool isIndirect = Subtarget->isTargetDarwin() &&
@@ -281,10 +281,16 @@ namespace {
 void ARMAsmPrinter::EmitFunctionEntryLabel() {
   if (AFI->isThumbFunction()) {
     OutStreamer.EmitRawText(StringRef("\t.code\t16"));
-    if (Subtarget->isTargetDarwin())
-      OutStreamer.EmitRawText("\t.thumb_func\t"+Twine(CurrentFnSym->getName()));
-    else    
+    if (!Subtarget->isTargetDarwin())
       OutStreamer.EmitRawText(StringRef("\t.thumb_func"));
+    else {
+      // This needs to emit to a temporary string to get properly quoted
+      // MCSymbols when they have spaces in them.
+      SmallString<128> Tmp;
+      raw_svector_ostream OS(Tmp);
+      OS << "\t.thumb_func\t" << *CurrentFnSym;
+      OutStreamer.EmitRawText(OS.str());
+    }
   }
   
   OutStreamer.EmitLabel(CurrentFnSym);