[clang] [llvm] Make sanitizer special case list slash-agnostic (PR #149886)
James Y Knight via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 6 09:46:45 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();
----------------
jyknight wrote:
Because we're talking about source files being read by the compiler, the interpretation of paths should be based on whether the compiler is built for and running on windows -- not based on what target the compiler defaults to build code for.
You could detect that with `#ifdef _WIN32`. But even better is to use the abstraction `llvm::sys::path::is_style_windows(llvm::sys::path::native)`, which does the same, but in a more self-documenting manner.
https://github.com/llvm/llvm-project/pull/149886
More information about the llvm-commits
mailing list