[llvm-objdump] Prevent variable locations to overlap short comments
authorIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 28 Jun 2021 07:23:22 +0000 (14:23 +0700)
committerIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 28 Jun 2021 07:25:21 +0000 (14:25 +0700)
commitc2e6bcb494c12b138283272e2e0932e13627898e
tree3e61b6fef004ea84e07935cb4901dc0b90373d0d
parentabe0fa43523502c549ff9394d28f9f29f5be0a3d
[llvm-objdump] Prevent variable locations to overlap short comments

For now, the source variable locations are printed at about the same
space as the comments for disassembled code, which can make some ranges
for variables disappear if a line contains comments, for example:

                                        ┠─ bar = W1
0:  add x0, x2, #2, lsl #12     // =8192┃
4:  add z31.d, z31.d, #65280    // =0xff00
8:  nop                                 ┻

The patch shifts the report a bit to allow printing comments up to
approximately 16 characters without interferences.

Differential Revision: https://reviews.llvm.org/D104700
llvm/docs/CommandGuide/llvm-objdump.rst
llvm/test/tools/llvm-objdump/ELF/AArch64/disassemble-print-comments.s
llvm/test/tools/llvm-objdump/ELF/ARM/debug-vars-dwarf4.s
llvm/test/tools/llvm-objdump/ELF/ARM/debug-vars-wide-chars.s
llvm/test/tools/llvm-objdump/X86/disassemble-print-comments.s
llvm/tools/llvm-objdump/llvm-objdump.cpp