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?
I am a Cppcheck developer.
You can run clang-tidy on visual studio solutions in the Cppcheck GUI.
It is a free open source (GPL) tool. You can download it here: http://cppcheck.sf.net
Some screenshots: http://cppcheck.sourceforge.net/clangtidy/index.html
It doesn't currently integrate other clang tools (for instance clang-format) but it is possible to extract the clang-tidy commands used by Cppcheck GUI.. maybe you can edit those.