Queries about FileCheck's CHECK-DAG: directive


I was reading the FileCheck tool documentation [1] this morning and a
two parts of the CHECK-DAG: directive don't quite seem right to me.


With captured variables, CHECK-DAG: is able to match valid topological
orderings of a DAG with edges from the definition of a variable to its

This is a little confusing. It is not explained what "captured
variables" are. My guess is it's referring to [2].

If my guess is correct then it probably shouldn't be referred to as
"captured variables" (using different names for the same thing in the
same document is confusing). Also, given that this is a tutorial
(which you'd usually read from beginning to end) shouldn't these file
check variables be explained before "CHECK-DAG:"? Alternatively
perhaps provide a link to the filecheck-variables section?


 If it’s necessary to match strings that don’t occur in a strictly
sequential order, “CHECK-DAG:” could be used to verify them between
two matches (or before the first match, or after the last match).

Although this statement is true it doesn't seem complete to me because
it's possible to before CHECK-DAG matches without any other matches as
is done in the example with only two CHECK-DAG: directives.

// CHECK-DAG: @_ZTV3Foo =
// CHECK-DAG: @_ZTV3Bar =

Any thoughts? If there is consensus about changes to the documentation
I'll happily write the patch (although someone will have to commit it
for me).

[1] http://llvm.org/docs/CommandGuide/FileCheck.html
[2] http://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-variables

Dan Liew.