[llvm] [clang] [SpecialCaseList] Use glob by default (PR #74809)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 13:45:23 PST 2023


MaskRay wrote:

> > > Probably would be good to introduce the `-v1` version and require it first, then eventually change the default - so people don't get a silent behavior change? Even the existing users only using `*` and `.` need to change their syntax to migrate to v2, right? They'll need to change `.*` to `*` and `.` to `?` and if they don't, their matches will start behaving strangely without a specific/actionable error message?
> > 
> > 
> > Since `#!special-case-list-v1` is just a comment and `v1` is the default before this change, users can actually add it to the first line today and the behavior won't change until Clang 19.
> 
> Right, but they wouldn't know to do that in advance of the behavior change, would they? If they do nothing/don't read any release notes, they'd get a silent behavior change, I think/if I'm understanding this correctly?

It will be silent but the main idea is that almost all special case lists are unaffected by this transition
https://discourse.llvm.org/t/use-glob-instead-of-regex-for-specialcaselists/71666 and my first comment are to demonstrate this.

I have checked CodeSearch (and ignorelist.txt uses in projects such as blue/v8/chromiumos) and actually haven't found any non-glob metacharacters uses (`(` `{` etc).

This is understandable: `src:` and `fun:` are the most common entries. `fun:` is almost always an exact function name or a glob with a leading/trailing `*`.
Many people tend to think `src:` uses globs and do not escape `.`. We have envisioned `src:a.(c|cpp)` (though I haven't seen such a use case) which can be satisfied by the glob brace expansion `src:a.{c,cpp}`.

Going forward, glob is the only supported format and we do not want users to annotate their ignore list with `#!special-case-list-v2` or `#!glob`.
Enforcing a `#!` header comment (by issuing a warning if not seen) would likely cause more disruption.


https://github.com/llvm/llvm-project/pull/74809


More information about the cfe-commits mailing list