[clang] [llvm] Make sanitizer special case list slash-agnostic (PR #149886)

Devon Loehr via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 14:20:10 PDT 2025


DKLoehr wrote:

For globs, there's a very simple rule that's spelled out in GlobPattern.h:
> `\` escapes the next character so it is treated as a literal.

If we canonicalize everything to forward slashes, then we'd be violating the first rule, since `foo\\bar` would match `foo/bar`, even though the escaped `\` should have been treated as a literal.

The current version of the PR introduces another simple rule:
> `/` matches both `\` and `/` in filenames on windows

which is (hopefully) easy to understand, and doesn't break anything existing.

> Seems like /\ ambiguity is also error prone. It's glob, how often \ will be confused with escape sequence?
> You have a difference problem now, why "\" does not match as expected (what ever is user expected)?

I'm not sure I totally understand the argument here, but needing to escape backslashes is very common so I would expect people who use windows are used to it.


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


More information about the llvm-commits mailing list