[PATCH] D28896: [FileCheck] Add directive for checking for blank lines

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 16:20:09 PST 2017

probinson added a comment.

I spent some time experimenting with different approaches, and my inner hacker is pleased to find something unobvious that works. Admittedly it is not as cleanly self-documenting as the new directive.


which must be run using the `--strict-whitespace` option to FileCheck, so that the `:space:` cannot match anything other than the newline between the two `$` metacharacters.  Also note the second directive is SAME not NEXT.  Without `--strict-whitespace` then additional spaces on the "empty" line would be allowed.  That option is really for extra-picky cases, but if you are caring about blank lines then it's pretty clear you already have an extra-picky case. :-)   Let me know if it doesn't work for you, or if you have other cases where this tactic would not be usable.

Alternatively, we could figure out how to get the regex package to recognize `\n` (and for that matter other backslash-escape sequences).  This has come up before, so I think that would be more valuable in the long run than adding another FileCheck directive.


More information about the llvm-commits mailing list