[llvm-branch-commits] [Support] Implement slash-agnostic path matching in GlobPattern (PR #202854)

Vitaly Buka via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 9 22:08:34 PDT 2026


https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/202854

Add a SlashAgnostic option to GlobPattern to allow matching path separators
(both forward slashes and backslashes) agnostically.

When enabled:
- We conservatively reduce the plain prefix and suffix by treating path
  separators as metacharacters. This ensures that path separators are
  matched via the slash-agnostic state machine rather than plain string
  comparison.
- Brackets containing slashes are adjusted to match both separators.
- Character comparisons in the state machine (matchChar) treat '/' and
  '\' as equivalent.

Co-authored-by: Devon Loehr <DKLoehr at users.noreply.github.com>

Assisted-by: Gemini





More information about the llvm-branch-commits mailing list