Ericsson / codechecker

CodeChecker is an analyzer tooling, defect database and viewer extension for static and dynamic analyzer tools.
https://codechecker.readthedocs.io
Apache License 2.0
2.28k stars 383 forks source link

Cache Results - especially clang-sa #4139

Open cmorty opened 11 months ago

cmorty commented 11 months ago

I am running code-checker in a CI without the web-frontend, only generating HTML-output. The codechecker-run is the longest running job. Caching results could greatly improve the performance.

I searched the net for caching clang-sa. However as ccache does not support this, and I haven't found other solutions.

I'm just a user of codechecker and no clang-sa/tidy/.. - expert. Yet if I understand things right: As long as no CTU-Analysis is active, hashing the pre-processor-output, clangsa-flags and -version should probably do the job, right?

bruntib commented 10 months ago

I think, the best performance could be gained by some ccache-like cache for Clang analysis results. Unfortunately I'm not aware of any. From CodeChecker point of view the analysis performance can be controlled only by running non-CTU as you mentioned, or turning off unnecessary and/or style checkers.

Yes, you're right, it sounds technically feasible to implement some caching of analysis results (i.e. plist files) based on the pre-processor output and some further data. The only difficulty should be generating a build command which does the pre-processing. According to my experiences, it's not always as simple as adding a -E flag, but having a study on this issue and some prototype implementation would be great.