[all-commits] [llvm/llvm-project] 8eb347: [SpecialCaseList] Add option to use Globs instead ...

Ellis Hoag via All-commits all-commits at lists.llvm.org
Fri Sep 1 09:06:27 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8eb34700c2b1847ec6dfb8f92b305b65278d2ec0
  Author: Ellis Hoag <ellis.sparky.hoag at gmail.com>
  Date:   2023-09-01 (Fri, 01 Sep 2023)

  Changed paths:
    M clang/docs/SanitizerSpecialCaseList.rst
    M clang/lib/Basic/ProfileList.cpp
    M clang/lib/Basic/SanitizerSpecialCaseList.cpp
    M llvm/include/llvm/Support/SpecialCaseList.h
    M llvm/lib/Support/SpecialCaseList.cpp
    M llvm/unittests/Support/SpecialCaseListTest.cpp

  Log Message:
  [SpecialCaseList] Add option to use Globs instead of Regex to match patterns

Add an option in `SpecialCaseList` to use Globs instead of Regex to match patterns. `GlobPattern` was extended in https://reviews.llvm.org/D153587 to support brace expansions which allows us to use patterns like `*/src/foo.{c,cpp}`. It turns out that most patterns only take advantage of `*` so using Regex was overkill and required lots of escaping in practice. This often led to bugs due to forgetting to escape special characters.

Since this would be a breaking change, we temporarily support Regex by default and use Globs when `#!special-case-list-v2` is the first line in the file. Users should switch to the glob format described in https://llvm.org/doxygen/classllvm_1_1GlobPattern.html. For example, `(abc|def)` should become `{abc,def}`.

See discussion in https://reviews.llvm.org/D152762 and https://discourse.llvm.org/t/use-glob-instead-of-regex-for-specialcaselists/71666.

Reviewed By: MaskRay

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

More information about the All-commits mailing list