[clang] [llvm] Make sanitizer special case list slash-agnostic (PR #149886)
James Y Knight via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 6 09:46:44 PDT 2025
================
@@ -57,9 +59,12 @@ Error SpecialCaseList::Matcher::insert(StringRef Pattern, unsigned LineNumber,
auto Glob = std::make_unique<Matcher::Glob>();
Glob->Name = Pattern.str();
Glob->LineNo = LineNumber;
+ // Backslashes are valid in posix-style filenames.
+ bool IsSlashAgnostic = Triple(sys::getDefaultTargetTriple()).isOSWindows();
// We must be sure to use the string in `Glob` rather than the provided
// reference which could be destroyed before match() is called
- if (auto Err = GlobPattern::create(Glob->Name, /*MaxSubPatterns=*/1024)
+ if (auto Err = GlobPattern::create(Glob->Name, /*MaxSubPatterns=*/1024,
+ /*IsSlashAgnostic=*/IsSlashAgnostic)
----------------
jyknight wrote:
Oh...also, we should really only apply special handling to filenames, not other kinds of strings. Perhaps "SpecialCaseList::inSection" needs a bool for whether to use filename matching semantics?
https://github.com/llvm/llvm-project/pull/149886
More information about the cfe-commits
mailing list