[Lldb-commits] [PATCH] D40616: ObjectFileELF: Add support for compressed sections

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 1 07:07:32 PST 2017


zturner added inline comments.


================
Comment at: lit/Modules/compressed-sections.yaml:20
+  - Name:            .bogus
+# CHECK-NOT: .bogus
+    Type:            SHT_PROGBITS
----------------
labath wrote:
> zturner wrote:
> > You should probably put this as the very first check statement.  Each successfully matching `CHECK` line will update an internal position and subsequent checks will only start from that position, so here you're only checking that after `.bogus` does not occur after `.hello_elf`, but this test would pass if `.bogus` occurred before `.hello_elf`.  But putting the `CHECK-NOT` first, both will fail  (this is also a good reason not to intersperse the check lines).
> Putting CHECK-NOT first will just make sure that .bogus does not appear *before* the first CHECK match. I put it last as it this is the place it is likely to be if it did we did end up outputting it, but if we want to be safe, I guess we have two options:
> - put it both at the front *and* back
> - have two FileCheck invocations
> I chose the latter.
I don't believe this is correct, and if it is then someone has introduced a bug in `FileCheck`.  matches do not succeed or fail based on what check lines come after.  They only succeed or fail based on the current file position.  If the file position is 0, and you say `CHECK-NOT`, then you are checking that it does not appear anywhere in the file (i.e. anywhere starting at position 0).  Assuming the test passes (i.e. it does not find it), the file position is not updated and then the CHECK line continues by making sure that it does appear.  And so on and so forth.


https://reviews.llvm.org/D40616





More information about the lldb-commits mailing list