[cfe-dev] clang-tidy: identify "C++-code-specific-checks" and "C-Code-specific-checks"
Aaron Ballman via cfe-dev
cfe-dev at lists.llvm.org
Wed Sep 15 04:13:25 PDT 2021
On Wed, Sep 15, 2021 at 3:09 AM Oza, Hiral via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> We are using clang-tidy with single ‘config-file’ listing enabled tidy-checks to run for both “C++-code” and “C-code”.
> We are looking for your inputs:
> From list of supported clang-tidy checks, how to identify "C++-code-specific-checks" and which are "C-Code-specific-checks"? Can this be checked programmatically?
There is not a way to identify them from the command line, but each
check has an `isLanguageVersionSupported()` function that checks for
valid language options that you can use to find this information via
> Are “clang-analyzer-“ checks only applied to C++-code?
Not always, those come from the static analyzer (rather than
explicitly written as clang-tidy checks) and many of those apply to C
code as well as C++ code (for example, there are checks specific to
malloc/free behavior, checks for division by zero, etc).
> What happens internally if C++-code-check ran on C-code? Will it skip parsing C-code?
If the check is designed to be C++-only, then it will be skipped for a
C translation unit.
> Thank you in advance for your valuable inputs.
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
More information about the cfe-dev