I would like to create a StaticAnalysis configuration within a Visual Studio (2012) Solution/set of projects that will just run clang-cl.exe --analyze for each of the source files in each project in the solution. We have both Mac and Windows versions of our product and want a common tool and output format to add static analysis to our process.
I have created batch files based on the MSBuild command that is actually issued by Visual Studio to generate all the plist output files. The batch files and supporting files capture all the settings that need to be added and removed to invoke a successful analysis run for each source file. [Already, I have been able to clean up quite a number of potential error areas.] I have attached samples; the .bat file’s extension was changed to .txt get around the email/attachment filter.
Is there a preferred way to integrate the clang analysis? My batch files always execute the clang command for every file. This is far too time consuming. Some of my projects have 100s of files. MSBuild already knows what has changed and needs to be re-compiled (taking into account all the dependencies), so I want to benefit from that, except checking for the plist time stamp instead of the .obj file’s timestamp. I also need to avoid additional maintenance to keep the clang analysis configuration in synch as source files are added or removed from each project.
The suggested method of changing the platform toolset does not work for me. I still need to do a normal build (using Microsoft’s compiler), not a complete switch to clang. And when calling clang-cl --analyze, object files are not created so the link step fails.
I hope this is the right forum and that I have given enough information but not included too much.
Thank you, Michael Mortensen
ControlPanel_Con_list.txt (2.69 KB)
ControlPanel_Con_analyze.txt (5.65 KB)