Oza, Hiral via llvm-dev
2021-Sep-15 07:09 UTC
[llvm-dev] clang-tidy: identify "C++-code-specific-checks" and "C-Code-specific-checks"
Greetings! 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: 1. 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? 2. Are "clang-analyzer-" checks only applied to C++-code? 3. What happens internally if C++-code-check ran on C-code? Will it skip parsing C-code? Thank you in advance for your valuable inputs. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210915/2e158995/attachment.html>
Andi-Bogdan Postelnicu via llvm-dev
2021-Sep-15 07:30 UTC
[llvm-dev] [cfe-dev] clang-tidy: identify "C++-code-specific-checks" and "C-Code-specific-checks"
Hello, Please see my comments inlined. [1] https://clang-analyzer.llvm.org/available_checks.html> On 15 Sep 2021, at 10:09, Oza, Hiral via cfe-dev <cfe-dev at lists.llvm.org> wrote: > > Greetings! > > 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?What are you trying to achieve? clang-tidy addresses more C++ checkers, I don’t recall seeing C specific checkers and no, you cannot determine this programatically since it’s a matter of matching at the AST level.> Are “clang-analyzer-“ checks only applied to C++-code?No, there are a wide variaty of checkers that apply to C and C++ [1]> What happens internally if C++-code-check ran on C-code? Will it skip parsing C-code?Nothing really, since the clang-tidy checkers are implemented mostly as matcher at the AST level and since specific nodes that are matched for a checkers are not present in the AST the checker will not get triggered.> > Thank you in advance for your valuable inputs. > _______________________________________________ > cfe-dev mailing list > cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210915/6ddf6d94/attachment.html>
Aaron Ballman via llvm-dev
2021-Sep-15 11:13 UTC
[llvm-dev] [cfe-dev] clang-tidy: identify "C++-code-specific-checks" and "C-Code-specific-checks"
On Wed, Sep 15, 2021 at 3:09 AM Oza, Hiral via cfe-dev <cfe-dev at lists.llvm.org> wrote:> > Greetings! > > 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 manual inspection.> 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. ~Aaron> > > > Thank you in advance for your valuable inputs. > > _______________________________________________ > cfe-dev mailing list > cfe-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev