[PATCH] D153587: [GlobPattern] Support brace expansions

Ellis Hoag via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 16:37:09 PDT 2023


ellis created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
ellis added reviewers: MaskRay, phosek, kyulee, ruiu, rupprecht.
ellis published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Extend `GlobPattern` to support brace expansions, e.g., `foo.{c,cpp}` as discussed in https://reviews.llvm.org/D152762#4425203.

The high level change was to turn `Tokens` into a list that gets larger when we see a new brace expansion term. Then in `GlobPattern::match()` we must check against each token group.

This is a breaking change since `{` will no longer match a literal without escaping. However, `\{` will match the literal `{` before and after this change. Also, from a brief survey of LLVM, it seems that `GlobPattern` is mostly used for symbol and path matching, which likely won't need `{` in their patterns.

See https://github.com/devongovett/glob-match#syntax for a nice glob reference.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153587

Files:
  llvm/include/llvm/Support/GlobPattern.h
  llvm/lib/Support/GlobPattern.cpp
  llvm/unittests/Support/GlobPatternTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153587.533765.patch
Type: text/x-patch
Size: 12847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230628/2bf189e1/attachment.bin>


More information about the llvm-commits mailing list