[PATCH] D18207: [llvm-objdump] Add '0x' prefix to a target displacement number to accent its hex format

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 18:37:19 PDT 2016


LGTM

On 16 March 2016 at 04:14, Simon Atanasyan <simon at atanasyan.com> wrote:
> atanasyan created this revision.
> atanasyan added a reviewer: rafael.
> atanasyan added a subscriber: llvm-commits.
> atanasyan set the repository for this revision to rL LLVM.
>
> It might be hard to recognize a hexadecimal number without '0x' prefix. Besides that '0x' prefix corresponds to GNU objdump behaviour.
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D18207
>
> Files:
>   test/tools/llvm-objdump/hex-displacement.test
>   tools/llvm-objdump/llvm-objdump.cpp
>
> Index: tools/llvm-objdump/llvm-objdump.cpp
> ===================================================================
> --- tools/llvm-objdump/llvm-objdump.cpp
> +++ tools/llvm-objdump/llvm-objdump.cpp
> @@ -1142,7 +1142,7 @@
>                    outs() << " <" << TargetName;
>                    uint64_t Disp = Target - TargetAddress;
>                    if (Disp)
> -                    outs() << '+' << utohexstr(Disp);
> +                    outs() << "+0x" << utohexstr(Disp);
>                    outs() << '>';
>                  }
>                }
> Index: test/tools/llvm-objdump/hex-displacement.test
> ===================================================================
> --- /dev/null
> +++ test/tools/llvm-objdump/hex-displacement.test
> @@ -0,0 +1,10 @@
> +# Check that target displacement has '0x' prefix
> +# to accent hex format of the number.
> +
> +# RUN: llvm-objdump -d %p/Inputs/export.dll.coff-i386 | FileCheck %s
> +
> +# CHECK:      exportfn2:
> +# CHECK-NEXT: 10002010:       50      pushl   %eax
> +# CHECK-NEXT: 10002011:       e8 00 00 00 00  calll   0 <exportfn2+0x6>
> +# CHECK-NEXT: 10002016:       50      pushl   %eax
> +# CHECK-NEXT: 10002017:       e8 00 00 00 00  calll   0 <exportfn2+0xC>
>
>


More information about the llvm-commits mailing list