-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Hi,
I'm on Windows and trying to use the -line-filter-argument to clang-tidy. This only worked on paths without folders (myfile.cpp). To ensure unique file names in the filter, I wanted to use paths with folders (instead of myfile.cpp use src/subfolder/myfile.cpp. I saw in the source that endswith is used on the file name (which I assume is a relative or absolute file path).
| if (FileName.ends_with(Filter.Name)) { |
I got it to work by using windows path separators (that had to be escaped), i.e. src\\subfolder\\myfile.cpp instead of src/subfolder/myfile.cpp. (even when using MINGW64/Git bash that is included in Git for Windows, this solution is neccessary)
-line-filter='[{"name":"subfolder\\myfile.cpp","lines":[[10,35]]}]'
This is a problem because I want to use clang-tidy-diff.py. It does work by modifying clang-tidy-diff.py
from
lines_by_file.setdefault(filename, []).append([start_line, end_line])
to
lines_by_file.setdefault(filename.replace("/", "\\"), []).append([start_line, end_line])
but it doesn't feel right that clang-tidy can't handle this internally.
The example usage of clang-tidy-diff.py is with git diff, which outputs unix path separators /.