Skip to content

Commit 7d4ad14

Browse files
committed
[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. llvm-svn: 358045
1 parent f8a74c1 commit 7d4ad14

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

llvm/lib/MC/MCInstPrinter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ using namespace llvm;
2121

2222
void llvm::dumpBytes(ArrayRef<uint8_t> bytes, raw_ostream &OS) {
2323
static const char hex_rep[] = "0123456789abcdef";
24+
bool First = true;
2425
for (char i: bytes) {
26+
if (First)
27+
First = false;
28+
else
29+
OS << ' ';
2530
OS << hex_rep[(i & 0xF0) >> 4];
2631
OS << hex_rep[i & 0xF];
27-
OS << ' ';
2832
}
2933
}
3034

llvm/tools/llvm-objdump/llvm-objdump.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ class PrettyPrinter {
614614
if (MI)
615615
IP.printInst(MI, OS, "", STI);
616616
else
617-
OS << " <unknown>";
617+
OS << "\t<unknown>";
618618
}
619619
};
620620
PrettyPrinter PrettyPrinterInst;
@@ -629,7 +629,7 @@ class HexagonPrettyPrinter : public PrettyPrinter {
629629
if (!NoShowRawInsn) {
630630
OS << "\t";
631631
dumpBytes(Bytes.slice(0, 4), OS);
632-
OS << format("%08" PRIx32, opcode);
632+
OS << format("\t%08" PRIx32, opcode);
633633
}
634634
}
635635
void printInst(MCInstPrinter &IP, const MCInst *MI, ArrayRef<uint8_t> Bytes,
@@ -768,7 +768,7 @@ class BPFPrettyPrinter : public PrettyPrinter {
768768
if (MI)
769769
IP.printInst(MI, OS, "", STI);
770770
else
771-
OS << " <unknown>";
771+
OS << "\t<unknown>";
772772
}
773773
};
774774
BPFPrettyPrinter BPFPrettyPrinterInst;

0 commit comments

Comments
 (0)