<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112038>112038</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] -line-filter only works with windows path separators on Windows
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
meastp
</td>
</tr>
</table>
<pre>
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).
https://github.com/llvm/llvm-project/blob/58d97034c9c149d175c66440d31f46e9dfd4b760/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp#L468
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`, ideally without having to modify this file/source code and manually convert to windows path separators.
The example usage of `clang-tidy-diff.py` is with git diff, which outputs unix path separators `/`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVU-Po7gT_TTOpRQEDn_CIYeZRMyvpd_uqaU5G1yAd43N2iZpvv2qHKKkZ2e0WqlFy6Sq_Kree4XwXg0G8cSKr6y47MQSRutOEwof5l1r5Xr6n2L8zNILS7_cn2-MVxNYA9-VkfbmQRgJwa3KDBAsLB4hjAisTPdaGdz3Sgd0dBRuWCY0gcI6LcywD0quCbyPyoM1eoWbdX-ipOKzCKOHmwqjXQL0Vkt0Hhg_sjKd1l5pTLp5ZmXKeJ3AuwU0fnEIi1F_LQgUAEZM6EGZiGeDwc_wB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