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

Shankar Easwaran via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 14:09:53 PDT 2026


quic-seaswara wrote:

sorry for my bad test. it looks like this test would never work. 

GlobPattern::create processes backslashes as escape characters during pattern compilation, not just during matching. So when it compiles C:\llvm\obj\1.o:

  - \l → compiled as "match literal l"
  - \o → compiled as "match literal o"
  - \1 → compiled as "match literal 1"

  The backslashes are consumed and discarded. The compiled pattern now describes the string C:llvmobj1.o.

 When match("C:\llvm\obj\1.o") runs, the input still has backslashes at positions where the compiled pattern expects l, o, and 1 directly — so it returns false.

  The pattern and the input look identical to a human but the match fails because the backslashes are stripped from the pattern during compilation while remaining in the input string during matching.

Please apply the reverted patches back. 

Sorry for the wrong analysis. 

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


More information about the llvm-commits mailing list