This is an archive of the discontinued LLVM Phabricator instance.

Add FileCheck -implicit-check-not option to allow stricter tests without adding too many CHECK-NOTs manually.
ClosedPublic

Authored by alexfh on Jul 10 2014, 8:01 AM.

Details

Summary

Add FileCheck -implicit-check-not option which allows specifying a
pattern that should only occur in the input when explicitly matched by a
positive check. This feature allows checking tool diagnostics in a way
clang -verify does it for compiler diagnostics.

The option has been tested on a number of clang-tidy checks, I'll post a link to
the clang-tidy patch to this thread.

Once there's an agreement on the general direction, I can add tests and
documentation.

Diff Detail

Event Timeline

alexfh updated this revision to Diff 11272.Jul 10 2014, 8:01 AM
alexfh retitled this revision from to Add FileCheck -implicit-check-not option to allow stricter tests without adding too many CHECK-NOTs manually..
alexfh updated this object.
alexfh edited the test plan for this revision. (Show Details)
alexfh added reviewers: djasper, bkramer.
alexfh added a subscriber: Unknown Object (MLST).

The change in clang-tidy tests used to test this patch is posted as D4463.

djasper edited edge metadata.Jul 10 2014, 8:04 AM

I don't know much about FileCheck's code, so I might not be the best reviewer. However, shouldn't you add at least one test making use of the new feature?

I don't think it is sufficient to have a test in clang-tools-extra...

In D4462#6, @djasper wrote:

I don't think it is sufficient to have a test in clang-tools-extra...

Sure, this is why I wrote "Once there's an agreement on the general direction, I can add tests and documentation.", where by "tests" I meant standalone tests for FileCheck.

alexfh updated this revision to Diff 11291.Jul 10 2014, 1:00 PM
alexfh edited edge metadata.

Added tests and documentation for -implicit-check-not.

bkramer accepted this revision.Jul 11 2014, 4:51 AM
bkramer edited edge metadata.

lg, with a minor test suggestion.

test/FileCheck/implicit-check-not.txt
2–5

Can we also have a test with multiple implicit-check-not patterns?

This revision is now accepted and ready to land.Jul 11 2014, 4:51 AM
alexfh updated this revision to Diff 11316.Jul 11 2014, 5:47 AM
alexfh edited edge metadata.

Added test for multiple -implicit-check-not directives and for regular expressions in -implicit-check-not.

alexfh closed this revision.Jul 11 2014, 5:47 AM