Fix a few more places to use PadToColumn instead of tabs. And fix
authorDan Gohman <gohman@apple.com>
Wed, 12 Aug 2009 18:47:05 +0000 (18:47 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 12 Aug 2009 18:47:05 +0000 (18:47 +0000)
the basic block label printing to check whether a block has a name
before printing a comment character and whitespace for it.

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

lib/CodeGen/AsmPrinter/AsmPrinter.cpp

index 35354750ef8c86d32a8dd0c7fbc18b9bf2591265..f0aa304a8bb5d21a97d32765761ae1672e2eb749 100644 (file)
@@ -1311,7 +1311,8 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
     if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
       SmallString<40> S;
       CI->getValue().toStringUnsigned(S, 16);
-      O << "\t\t\t" << TAI->getCommentString() << " 0x" << S.c_str();
+      O.PadToColumn(TAI->getCommentColumn(), 1);
+      O << TAI->getCommentString() << " 0x" << S.c_str();
     }
   }
   O << '\n';
@@ -1635,11 +1636,12 @@ void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB,
   if (printColon)
     O << ':';
   if (printComment) {
-    O.PadToColumn(TAI->getCommentColumn(), 1);
-
-    if (MBB->getBasicBlock())
-      O << '\t' << TAI->getCommentString() << ' '
-        << MBB->getBasicBlock()->getNameStr();
+    if (const BasicBlock *BB = MBB->getBasicBlock())
+      if (BB->hasName()) {
+        O.PadToColumn(TAI->getCommentColumn(), 1);
+        O << TAI->getCommentString() << ' '
+          << MBB->getBasicBlock()->getName();
+      }
 
     if (printColon)
       EmitComments(*MBB);