Files
Junji Watanabe 4ea39c43e1 [LIT] Use forward slashes in substitutions when LLVM_WINDOWS_PREFER_FORWARD_SLASH is set (#179865)
When building with `-DLLVM_WINDOWS_PREFER_FORWARD_SLASH=ON`, tools like
lld output paths with forward slashes on Windows. However, lit's default
substitutions (`%t`, `%p`) typically use backslashes on Windows, causing
FileCheck failures in tests that strictly match path separators.

This patch propagates the `LLVM_WINDOWS_PREFER_FORWARD_SLASH` build flag
to llvm-lit via `builtin_parameters`. It also updates lit's TestRunner
to respect the 'use_normalized_slashes' parameter. When enabled, lit
normalizes paths in substitutions to use forward slashes, ensuring that
test expectations align with the tool output.

With this fix, the number of failed tests with
`-DLLVM_WINDOWS_PREFER_FORWARD_SLASH=ON` changes as follow:

- The total number of failed tests: 303 -> 168
- Break down:
  - `Builtins-i386-windows` tests: 99 -> 0
  - `Clang` tests: 28 -> 5
  - `Clang Tools` tests: 7 -> 1
  - `LLVM` tests: 6 -> 4
  - `lld` tests: 2 -> 0
- Other failed tests:
  - `glang`: 1
  - `Clang-Unit`: 5
  - `Clangd`: 3
  - `Clangd Unit Tests`: 150
  - `LLVM-Unit`: 1
2026-03-03 16:45:06 +11:00
..