[all-commits] [llvm/llvm-project] 36ede5: [clang-tidy] Normalize windows line filter paths (...

Chris Apple via All-commits all-commits at lists.llvm.org
Wed Sep 9 20:39:47 PDT 2026


  Branch: refs/heads/release/23.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 36ede5c3922bec1854eba069ca8cfc2a599994f2
      https://github.com/llvm/llvm-project/commit/36ede5c3922bec1854eba069ca8cfc2a599994f2
  Author: Chris Apple <cja-private at pm.me>
  Date:   2026-09-10 (Thu, 10 Sep 2026)

  Changed paths:
    M clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
    M clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/infrastructure/clang-tidy-diff.cpp
    M clang-tools-extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp
    M clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
    M clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h

  Log Message:
  -----------
  [clang-tidy] Normalize windows line filter paths (#217038)

`git | clang-tidy-diff.py` emits line-filter paths with forward slashes,
while Windows compilation databases use a mix of forwards and backwards
slashes. These paths are then silently rejected (and no report is
emitted).

Reproduce on windows via:
```
git.exe diff -U0 main -- . | python clang-tidy-diff.py -p1 -path .\build"
```

Git will produce a path like:
```
my/source/file.cpp
```

The compilation database has files with entries like this:
```
  "file": "C:\\dev\\repo\\my\\source\\file.cpp",
  "output": "my\\source\\CMakeFiles\\source.dir\\file.cpp.obj"
```

Clang tidy tries to match these paths, but fails on the slash
comparison.

Do a few things to fix this:
* Normalize filter paths with `llvm::sys::path::convert_to_slash()`
before matching the compilation database. This is a no-op on posix, but
converts windows forward slashes to backwards.
* Normalize `Filter.Name` paths when parsed
* Write a couple more unit tests for windows specific paths that expose
this behavior
* Enable another UNSUPPORTED test for windows clang-tidy-diff (and make
it run in a nested directory to exercise the issue

Fixes https://github.com/llvm/llvm-project/issues/112038.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list