[PATCH] D68061: [docs] Document pattern of using CHECK-SAME to skip irrelevant lines

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 11:01:13 PDT 2019


rupprecht added inline comments.


================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:290
+
+Another common use case for "``CHECK-SAME:``" is to avoid writing matchers for
+irrelevant fields. For example, suppose you're writing a test which parses a
----------------
jhenderson wrote:
> thopre wrote:
> > Nit: rather than say that it is common, it might be better to say that CHECK-SAME is useful in dealing with X. Whether it is common or not does not seem very relevant.
> Yeah, I agree with this. I wrote it for the first time a few months ago, and as far as I know, it was the first time it was used for this purpose (certainly I came up with it independently!), so "common" seems like a stretch at the moment.
Fair enough, I just figured everyone besides me was familiar with this trick :)


================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:333
+   CHECK:      Value:
+   CHECK-SAME:   1
+
----------------
MaskRay wrote:
> Maybe align `1` to the position 2 columns right of `Value:` above.
Did you mean 1 column (from the colon)?


================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:335-336
+
+This verifies that the *next* line that contains "``Value:``" has the value
+``1``.
+
----------------
MaskRay wrote:
> jhenderson wrote:
> > Maybe this would be better phrased as "This verifies that the next time "``Value:``" appears in the output, it has a value of 1.
> > 
> > It might also be worth a note saying to use `{{$}}` immediately after too, to avoid a spurious match on `Value: 16` or similar. Not sure if it really belongs here, or somewhere else though.
> The suggestion looks good. So the example should be 
> 
> ```
> CHECK:      Value:
> CHECK-SAME:        1{{$}}
> ```
> 
I added `{{$}}` to the original matcher, it should be there too


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68061





More information about the llvm-commits mailing list