[PATCH] D64969: [llvm-objdump][NFC] Make the PrettyPrinter::printInst() output buffered
Seiya Nuta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 23 22:56:59 PDT 2019
seiya updated this revision to Diff 211427.
seiya added a comment.
- Track the column manually to remove formatted_raw_ostream.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64969/new/
https://reviews.llvm.org/D64969
Files:
llvm/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -668,24 +668,20 @@
if (SP && (PrintSource || PrintLines))
SP->printSourceLine(OS, Address);
- {
- formatted_raw_ostream FOS(OS);
- if (!NoLeadingAddr)
- FOS << format("%8" PRIx64 ":", Address.Address);
- if (!NoShowRawInsn) {
- FOS << ' ';
- dumpBytes(Bytes, FOS);
- }
- FOS.flush();
- // The output of printInst starts with a tab. Print some spaces so that
- // the tab has 1 column and advances to the target tab stop.
- unsigned TabStop = NoShowRawInsn ? 16 : 40;
- unsigned Column = FOS.getColumn();
- FOS.indent(Column < TabStop - 1 ? TabStop - 1 - Column : 7 - Column % 8);
-
- // The dtor calls flush() to ensure the indent comes before printInst().
+ size_t Start = OS.tell();
+ if (!NoLeadingAddr)
+ OS << format("%8" PRIx64 ":", Address.Address);
+ if (!NoShowRawInsn) {
+ OS << ' ';
+ dumpBytes(Bytes, OS);
}
+ // The output of printInst starts with a tab. Print some spaces so that
+ // the tab has 1 column and advances to the target tab stop.
+ unsigned TabStop = NoShowRawInsn ? 16 : 40;
+ unsigned Column = OS.tell() - Start;
+ OS.indent(Column < TabStop - 1 ? TabStop - 1 - Column : 7 - Column % 8);
+
if (MI)
IP.printInst(MI, OS, "", STI);
else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64969.211427.patch
Type: text/x-patch
Size: 1528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190724/eaae29b4/attachment.bin>
More information about the llvm-commits
mailing list