[llvm] [Support] Extract simple suffix from GlobPattern (PR #162118)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 13:27:12 PDT 2025


================
@@ -143,6 +143,15 @@ GlobPattern::create(StringRef S, std::optional<size_t> MaxSubPatterns) {
     return Pat;
   S = S.substr(PrefixSize);
 
+  // Just in case we stop on unmatched opening brackets.
+  size_t SuffixStart = S.find_last_of("?*[]{}\\");
+  assert(SuffixStart != std::string::npos);
+  if (S[SuffixStart] == '\\')
----------------
fmayer wrote:

Can't a `\` escape be multiple characters, e.g. for a oct escape?

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


More information about the llvm-commits mailing list