[llvm] r358045 - [llvm-objdump] Don't print trailing space in dumpBytes
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 22:31:22 PDT 2019
Author: maskray
Date: Tue Apr 9 22:31:21 2019
New Revision: 358045
URL: http://llvm.org/viewvc/llvm-project?rev=358045&view=rev
Log:
[llvm-objdump] Don't print trailing space in dumpBytes
In disassembly output, dumpBytes prints a space, followed by a tab
printed by printInstr. Remove the extra space.
Modified:
llvm/trunk/lib/MC/MCInstPrinter.cpp
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Modified: llvm/trunk/lib/MC/MCInstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCInstPrinter.cpp?rev=358045&r1=358044&r2=358045&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCInstPrinter.cpp (original)
+++ llvm/trunk/lib/MC/MCInstPrinter.cpp Tue Apr 9 22:31:21 2019
@@ -21,10 +21,14 @@ using namespace llvm;
void llvm::dumpBytes(ArrayRef<uint8_t> bytes, raw_ostream &OS) {
static const char hex_rep[] = "0123456789abcdef";
+ bool First = true;
for (char i: bytes) {
+ if (First)
+ First = false;
+ else
+ OS << ' ';
OS << hex_rep[(i & 0xF0) >> 4];
OS << hex_rep[i & 0xF];
- OS << ' ';
}
}
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=358045&r1=358044&r2=358045&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Tue Apr 9 22:31:21 2019
@@ -614,7 +614,7 @@ public:
if (MI)
IP.printInst(MI, OS, "", STI);
else
- OS << " <unknown>";
+ OS << "\t<unknown>";
}
};
PrettyPrinter PrettyPrinterInst;
@@ -629,7 +629,7 @@ public:
if (!NoShowRawInsn) {
OS << "\t";
dumpBytes(Bytes.slice(0, 4), OS);
- OS << format("%08" PRIx32, opcode);
+ OS << format("\t%08" PRIx32, opcode);
}
}
void printInst(MCInstPrinter &IP, const MCInst *MI, ArrayRef<uint8_t> Bytes,
@@ -768,7 +768,7 @@ public:
if (MI)
IP.printInst(MI, OS, "", STI);
else
- OS << " <unknown>";
+ OS << "\t<unknown>";
}
};
BPFPrettyPrinter BPFPrettyPrinterInst;
More information about the llvm-commits
mailing list