Page MenuHomePhabricator

Allow matching "any file" in `VerifyDiagnosticConsumer`.
Needs ReviewPublic

Authored by arames on Jan 2 2020, 12:54 PM.



This allows specifying * for the filename to match any file. For example:

// expected-note@*:* {{Match this note in any file at any line.}}
// expected-note@*:123 {{Match this note in any file at line 123.}}

Event Timeline

arames created this revision.Jan 2 2020, 12:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 2 2020, 12:54 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
arames added a comment.Jan 2 2020, 1:00 PM

This is for example useful to add a catch-all clause like // expected-note-re@*:* 1+ {{candidate function {{.+}}}}

jkorous added inline comments.

I feel that we should test the output with FileCheck to make it more robust.
Seems like other tests for -verify do that. For example here:


Can we add some scenarios for expected diagnostics not produced?

arames marked 3 inline comments as done.Jan 23 2020, 10:32 AM
arames added inline comments.

While testing, I realized this cannot be handled reliably, so will require the line number to be * when the filename is *.

I was using the current file and specified line for the SourceLocation in this case. But this fails if the specified line number is greater than the number of lines in the current file.

arames updated this revision to Diff 239972.Jan 23 2020, 12:07 PM

Address review comments.

We should either simplify the implementation to reflect that we don't support e. g. *:42 (seems preferable to me) or have the codepaths that are currently not accessible through -fverify tested by other means.


Should we rename it to MatchAnyFileAndLine?


Should we make it clear from the interface that MatchAnyFile => MatchAnyLine?