The other day someone on IRC asked if -verify supported regex; attached is a patch for regex and glob-style matching. They're selected by using one of '-', '~' or '*' for string, regex and glob matching. Maybe '?' would be better for glob? Here's a few pertinent lines from the header docs:
/// Alternative matching modes may be specified via the first character which
/// follows 'expected'. The following modes are supported:
///
/// - standard string matching, case-sensitive
/// ~ regular-expression matching
/// * glob-style matching
///
/// Examples: match error "variable has incomplete type 'struct s'"
///
/// // expected-error {{variable has incomplete type 'struct s'}}
/// // expected-error {{variable has incomplete type}}
///
/// // expected~error {{variable has has type 'struct .'}}
/// // expected~error {{variable has has type 'struct .*'}}
/// // expected~error {{variable has has type 'struct (.*)'}}
///
/// // expected*error {{variable has incomplete type 'struct ?'}}
/// // expected*error {{variable has incomplete type 'struct [stuv]'}}
/// // expected*error {{variable has incomplete type 'struct [!abcd]'}}
/// // expected*error {{variable has incomplete type 'struct *'}}
The other day someone on IRC asked if -verify supported regex;
attached is a patch for regex and glob-style matching. They're
selected by using one of '-', '~' or '*' for string, regex and glob
matching. Maybe '?' would be better for glob? Here's a few pertinent
lines from the header docs:
The expected-error, expected~error, and expected*error are so similar as
to be confusing. Why not simply have expected-error, expected-error-re,
and expected-error-glob? It's only a few extra characters, and much more
noticeable.
Patch update uses suggested '-re' and '-glob' syntax, patch attached.
- lit tests pass with clang-debug, clang-release and selfclang-debug builds
- no measurable performance impact on lit tests
***Changes from last patch:
- updated syntax to use suffixes { -re | -glob } for regex and globbing, respectively
- added glob sequence support: first element ']' treated as literal
- reworked verify-string parser to be more resilient to errors
- added lit test/Misc/verify.c
***Examples matching error: "variable has incomplete type 'struct s'"
// expected-error {{variable has incomplete type 'struct s'}}
// expected-error {{variable has incomplete type}}
// expected-error-re {{variable has has type 'struct .'}}
// expected-error-re {{variable has has type 'struct .*'}}
// expected-error-re {{variable has has type 'struct (.*)'}}
// expected-error-re {{variable has has type 'struct[[:space:]](.*)'}}
// expected-error-glob {{variable has incomplete type 'struct ?'}}
// expected-error-glob {{variable has incomplete type 'struct [stuv]'}}
// expected-error-glob {{variable has incomplete type 'struct [!abcd]'}}
// expected-error-glob {{variable has incomplete type 'struct *'}}