Clang static analyzer: Scan-build: No bugs found with msbuild

Hello developers,

I am trying to analyze my c++ visual studio project with clang static analyzer. I have built the clang project from svn repository and added the clang binaries folder to the Path.

But, when I run the following command, MSBuild only builds the project and there is no analysis from clang.

Project folder>scan-build.bat --use-analyzer=D:\llvm-build\Debug\bin\clang.exe “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe” Common.vcxproj

The output I get is

Build succeeded. 0 Warning(s) 0 Error(s)

Time Elapsed 00:00:04.72 scan-build: Removing directory ‘\Local\Temp/scan-build-2018-11-15-145207-11916-1’ because it contains no reports. scan-build: No bugs found.

Could anyone tell me what is wrong here?

Thanks in advance!

Best regards,


Hi Irin,

scan-build works by replacing the CC variable with the name of the analyzer,
that might not work on visual studio.
Quick googling suggests that you might be able to extract the compilation database using visual studio plugins,
and then you can run the analyzer on that, using the analyze-build python script (IIRC, it is pip-installable).