I'm trying to apply clang modernization on files either from within visual studio, or from the command line, making use of the includes paths and settings in my visual studio 2015 C++ projects.
I created a clang-tidy settings file, like this:
clang-tidy -dump-config=.clang-tidy
-checks="modernize-loop-convert,modernize-deprecated-headers"
and verified that it works on a single file, from (cygwin) command line: clang-tidy.exe -explain-config
lists (among other things)
'modernize-deprecated-headers' is enabled in the C:\abc\.clang-tidy.
and I can run it on individual files by setting up the includes by hand:
clang-tidy.exe someFile.cpp -- -Ic:/abc -I. -IIncludes
I installed the visual studio clang-format VS plugin, and created an example .clang-format file, { BasedOnStyle: "LLVM", IndentWidth: 20 }
which is picked up by the VS plugin. I then naively tried to feed clang-format with the clang-tidy configuration, but unsurprisingly that does not work at all.
To summarize: how to run clang-tidy on files and visual studio projects?
Perhaps a workaround would be to dump out the includes for each file from visual studio? Any way forward will do.
For reference:
How can I enable clang-tidy's "modernize" checks?
How to feed Visual Studio Clang-Format plugin with clang-format file?
Visual Studio 2019 version 16.4+ has native support for
clang-tidy
!