How to check only one checker by CLANG?
When i use clang to check warning, i use this way
# clang --analyze *.c
I want to use ONLY ONE CHECKER to check it.
ex) core.DivideZero(C, C++, ObjC) only
Pls tell me some options to do it!
How to check only one checker by CLANG?
When i use clang to check warning, i use this way
# clang --analyze *.c
I want to use ONLY ONE CHECKER to check it.
ex) core.DivideZero(C, C++, ObjC) only
Pls tell me some options to do it!
Copyright © 2021 Jogjafile Inc.
To run a single checker using
clang --analyze, add--analyzer-no-default-checks -Xanalyzer -analyzer-checker=<checker>to the command line. For example:In this case,
hello.ccontains three defects of various kinds that would be reported by default, but by enabling onlycore.DivideZero, just that one is reported. The code fragment that provokes this report is:I figured out how to run a single checker mainly by looking at the Clang Command Line Argument Reference, but that's not very clear so it needed some trial and error as well. The
clangprogram is sort of a multi-purpose front-end that calls other tools under the hood, so getting all the switches in the right places with the right-X,-, and--prefixes is a bit of a challenge.Also useful is the list of Available Checkers, which includes names like
core.DivideZero.I tested with clang+llvm versions 3.7.1 and 8.0.1 on Linux/x86_64.