[PATCH] D63393: [llvm-objdump] Remove unnecessary indentation when dumping ELF data.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 04:50:17 PDT 2019


jhenderson added inline comments.


================
Comment at: llvm/test/tools/llvm-objdump/X86/disassemble-code-data-mix.s:17
 
 // CHECK:        b:        74 65 73 74 20 73 74 72         test str
 // CHECK-NEXT:  13:        69 6e 67 00                     ing.
----------------
MaskRay wrote:
> ychen wrote:
> > MaskRay wrote:
> > > Assume you'll update this part when committing...
> > I thought I don't need to. Without this change,  the modified test should fail.
> > 
> > // CHECK: b: 74 65 73 74 20 73 74 72 test str
> >           ^
> > <stdin>:2:1: note: scanning from here
> > <stdin>:|file format ELF64-x86-64
> > ^
> > <stdin>:15:2: note: possible intended match here
> >  b:| 74 65 73 74 20 73 74 72 test str
> >  ^
> > 
> ok, you probably need `FileCheck --strict-whitespace`
There are two related switches here that are important to note. I haven't inspected the test enough to figure out which are the right ones to use here. The default behaviour is for FileCheck to ignore leading and trailing whitespace, and to replace all contiguous whitespace with a single space, both in the CHECK lines and in the text it is checking again. `--strict-whitespace` overrides the latter of these, but not the former, whilst `--match-full-lines` overrides the former but not the latter. Using both means you get an exact match of the line, whitespace and everything, which is usually what you want when you are testing formatting (though you can also use regexes to achieve some of the same thing). One gotcha with doing both is that if you do this, you can't have a space character between any CHECKs and the first character you are checking, unless your line starts with a space.

Also, watch out for hard tabs, since editors will often get rid of those. If checking hard tabs, use `{{\t}}` explicitly (together with `--strict-whitespace`).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63393/new/

https://reviews.llvm.org/D63393





More information about the llvm-commits mailing list