codechecker
codechecker copied to clipboard
[analyze] Add option to control Clang SA header analysis and macro expansion
Added two options
--analyze-headers [on|off](default on) to enable/disable clang SA analysis of headers--expand-macros [on|off](default on) to enable/disable macro expansion in generated plist
I'm proposing this change to reduce analysis time for precommit approval. The project I'd like to apply it to consists of approx 1600 source files and takes 5 1/2 hours to analyze with expand-macros=true and -analyzer-opt-analyze-headers enabled. Not setting those options reduces analysis time to ~30 minutes, which is acceptable for a precommit check
Hi!
Sorry for the late response, we definitely appreciate all the help we can get!
We already have an option to pass clang static analyzer flags through CodeChecker via the --saargs option. Wouldn't that be a good solution for you?
The problem I foresee is that CodeChecker is (increasingly) less of wrapper around Clang, and more of a general static analysis driver tool, so creating analyzer specific flags may go contradictory to that. This doesn't mean we make exceptions (just look at all the CTU options that, as of now, specifically target ClangSA), I'm just not immediately sure we want to make one here.
Cheers, Husi
The problem is that codechecker sets -analyzer-opt-analyze-headers and there is no option to clang to turn it off once its passed on the cli. And because it already passes expand-macros=true a subsequent expand-macros=false fails as well with
error: error reading 'expand-macros=false'
How about just removing '-analyzer-opt-analyze-headers' and 'expand-macros=true' and require people who want it to add those options via --saargs
Hi,
Sorry for the extreme slow reply. So, I would say, that -analyzer-opt-analyze-headers should be turned on by default, because we wouldn't like to introduce CI-breaking changes for teams that integrated CodeChecker. I can be convinced about expand-macros if it causes massive performance loss, but we turned that on for the GUI functionality which displays these macros.
On the other hand I would still vote on using --analyzer-config flag when providing any analyzer config options.
Thank you!