[PATCH] D47106: [FileCheck] Make CHECK-DAG non-overlapping

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 23 07:25:45 PDT 2018


jdenny added inline comments.


================
Comment at: utils/FileCheck/FileCheck.cpp:1245
       // All subsequent CHECK-DAGs should be matched from the farthest
-      // position of all precedent CHECK-DAGs (including this one.)
+      // position of all precedent CHECK-DAGs (not including this one).
       StartPos = LastPos;
----------------
Speaking of the reordering check, we should discuss this comment change.

I made this change to reflect the implementation, but now I'm wondering if the comment described the desired behavior and the implementation was wrong.  I'm not really sure.  Moreover, this comment change does not reflect any change made by this patch, so perhaps it should be in a separate patch.

The implementation works as follows (with or without this patch as there's no overlapping here).  Using the X-Y model from earlier, the implementation seeks non-initial members of Y from the end of X rather than the start of Y.  For example, the following succeeds even though the second member of Y matches before the first member of Y:


```
X:
abc

Y:
ghi
def
foo
jkl

X:
CHECK-DAG: {{^}}abc

CHECK-NOT: {{^}}foo

Y:
CHECK-DAG: {{^}}def
CHECK-DAG: {{^}}ghi
CHECK-DAG: {{^}}jkl
```

To make things more confusing, if I move the occurrence of foo right before the occurrence of def, the CHECK-NOT fails.  That is, the CHECK-NOTs are sought before the first member of Y, but the other members of Y are sought both before and after Y.  It might be more intuitive if the first member of Y marks the beginning of Y (as the comment originally claimed) so that CHECK-NOTs are sought strictly between all of X and all of Y.


https://reviews.llvm.org/D47106





More information about the llvm-commits mailing list