I would like to talk about an attempt to use clang-modernize and clang-tidy,
and clang-analyzer on windows.
I'm using CMake 3 and Visual studio 2013.
I would like to use the various great tools of clang to scan over my code
base, but these seems to take a compile_commands.json file as input (this
file should be in the build path provided by the "-p" option of those
But sadly the CMAKE_EXPORT_COMPILE_COMMAND=ON option does not work with the
visual generator (which I use)
Some great people of Clang community are talking about here
Their point is that it could be in the future added to CMake, but that they
would prefer to not rely on it. Anyway, because of this *"Richard" decided
to use the Log output of MSBuild to generate the compile_commands.json file*
which he says should work.
Therefore as I don't see any of this implemented yet in a public repo, I
decided to implement myself a little script to transform the output of the
MSBuild log (that i get using "/fl
as options to MSBuild, and parse it to generate a compile_commands.json
See here an example of a simple project which has only 1 cpp file:
Then I used
*clang-modernize -p=<build-path> -summary -include=<src_dir>*
*clang-tidy -p=<build-path> src/main.cpp*
Which leads to a lot of warnings and an error because "<stdlib.h> could not
See the console log attached. log.log
Do you have any idea of what is wrong?
Should I get as many errors, it looks like the tools don't understand the
Should this fail because of stdlib.h?
what could be a solution?
Is my use of the tools (command line parameters) right?
But as I yet do not know how to