copperspice and LLVM clang-check SCA (static code analysis)

Discuss anything related to product development
Post Reply
marlowa
Posts: 117
Joined: Sun Oct 25 2015 10:52 am

copperspice and LLVM clang-check SCA (static code analysis)

Post by marlowa »

Hello everyone,

Are there any plans for copperspice to use the LLVM clang-check static code analysis (SCA) tool? This tool is very useful for spotting potential trouble spots and for warning when old style constructs are used where they are modern equivalents. For example, when a virtual function is overridden it is now considered good practice to use the override keyword in the signatures of those functions that are overriding. There are just loads of such issues that clang-check can watch out for.

I happened to notice that override is used but not consistently throughout copperspice so so I suspect this tool is not being used yet. I strongly recommend it although I do admit it is quite hard to set up initially since the way you run it requires a json file to be created to describe the job. The description includes all the include directories to search and preprocessor macros that are required. When I've done this I wrote a python script to generate the json by scanning the Visual Studio project file. Also clang-check runs quite slowly. It can take 5 seconds or so per file. With the 1768 files in copperspice that would take about 2.5 hours. I found that an SCA can proceed more quickly if json files are reused for all the files in a given directory when a common set of project properties apply. Such files can be processed in parallel with some nifty python programming.

Regards,

Andrew Marlow.
Post Reply