[all-commits] [llvm/llvm-project] 8daace: [GlobPattern] Support brace expansions

Ellis Hoag via All-commits all-commits at lists.llvm.org
Wed Aug 30 08:31:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8daace8b2d89b50daeeb2634ef96c915d1800e5f
      https://github.com/llvm/llvm-project/commit/8daace8b2d89b50daeeb2634ef96c915d1800e5f
  Author: Ellis Hoag <ellis.sparky.hoag at gmail.com>
  Date:   2023-08-30 (Wed, 30 Aug 2023)

  Changed paths:
    M llvm/include/llvm/Support/GlobPattern.h
    M llvm/lib/Support/GlobPattern.cpp
    M llvm/unittests/Support/GlobPatternTest.cpp

  Log Message:
  -----------
  [GlobPattern] Support brace expansions

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.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D153587




More information about the All-commits mailing list