[PATCH] D68066: [llvm-objdump] Further rearrange llvm-objdump sections for compatability

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 14:44:22 PDT 2019


rupprecht added a comment.

In D68066#1692390 <https://reviews.llvm.org/D68066#1692390>, @justice_adams wrote:

> @rupprecht With most of the lit test adjustments here the only change was the ordering, which makes sense. Could you help me understand why the addition of the various `[1-9]` style regex expressions were also added to certain tests? Are those just ensuring more verbose matches with FileCheck?


In `llvm/test/MC/COFF/symidx.s` for example, the thing we're matching was originally:

  Contents of section .data:
    0000 0b000000 0a000000
  SYMBOL TABLE:
    [ a] ... foo
    [ b] ... bar

where `a` and `b` are single digit numbers. We don't necessarily know or care what those values are, just that they should have the same value in both places. So we capture it the first time we see the pattern, and then match against it the second time we see it.

For the line:

  // CHECK-NEXT:  0000 0[[BAR:[1-9]]]000000 0[[FOO:[1-9]]]000000

The `[[BAR:[1-9]]]` means to look for the regex `[1-9]` and capture it in variable `BAR`. We can then subsequently write a check that verifies we see a line with that previously captured value:

  // CHECK-NEXT: [ [[BAR]]](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x00000001 bar

e.g. if BAR is captured to be 7, the test is equivalent to:

  // CHECK-NEXT: [ 7](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x00000001 bar

This is described in more detail here: http://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-string-substitution-blocks

Anyway: this patch changes the order of sections to:

  SYMBOL TABLE:
    [ a] ... foo
    [ b] ... bar
  Contents of section .data:
    0000 0b000000 0a000000


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68066





More information about the llvm-commits mailing list