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

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 26 07:39:37 PDT 2018


probinson accepted this revision.
probinson added a comment.
This revision is now accepted and ready to land.

One doc question, otherwise LGTM.



================
Comment at: docs/CommandGuide/FileCheck.rst:247
+
+If you need to check that the next line is blank, you can use the
+"``CHECK-EMPTY:``" directive.
----------------
Hm.  Is whitespace allowed on the "blank" line?  Even if `--match-full-lines` is not in effect?  If whitespace is always disallowed, then maybe instead of "is blank" this should say something like "has nothing on it, not even whitespace" ?


================
Comment at: test/FileCheck/check-empty-tag.txt:13
+CHECK2A: the next line has spaces
+CHECK2A-EMPTY:
+CHECK2B: expected string not found in input
----------------
jhenderson wrote:
> probinson wrote:
> > I believe this CHECK2A: line will match itself, and the "next line" therefore has a CHECK2A-EMPTY directive on it.  If you run FileCheck manually I think you'll see that from the line number reported by the error.
> > I see that you are intending to match a line at the end of this file.  To achieve that you want to add some kind of regex to the CHECK2A line.  Something like `the {{next}} line has spaces` would work.
> > I believe this CHECK2A: line will match itself, and the "next line" therefore has a CHECK2A-EMPTY directive on it. If you run FileCheck manually I think you'll see that from the line number reported by the error.
> I thought of that at the time I originally wrote this, but it doesn't because of the "--match-full-lines" switch, since the "CHECK2A:" prefix prevents matching there.
> 
> I'm not sure I follow the need for a regex?
A regex is a way for a CHECK line to avoid matching itself; you see this in some of the other FileCheck tests. But with `--match-full-lines` you don't need that trick; sorry I missed that.


Repository:
  rL LLVM

https://reviews.llvm.org/D28896





More information about the llvm-commits mailing list