[PATCH] D46188: [clang-tidy] Add a flag to enable debug checkers

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 8 06:56:41 PDT 2018


alexfh added a comment.

In https://reviews.llvm.org/D46188#1091237, @lebedev.ri wrote:

> In https://reviews.llvm.org/D46188#1091221, @alexfh wrote:
>
> > I don't think debug CSA checkers belong to clang-tidy. If one needs to dump CFG, they are probably doing quite involved stuff already, so going a step further and running `clang -cc1 -analyze` would not be difficult. The motivation for exposing alpha checkers (letting users test them and provide feedback) doesn't work for debug checkers.
>
>
> There is word play here.
>  They are debug CSA checkers. But not all of them are debugging the CSA. Many of them are just utility checkers that could be just as easily a clang-tidy debug/utility checkers:


I roughly understand what debug CSA checkers are. However, I don't see much value in exposing them in clang-tidy. While it may be valuable to look at the CFG dump when developing a clang-tidy check, for example, but this can be done using clang

  $ clang -cc1 -help | grep cfg
   -cfg-add-implicit-dtors Add C++ implicit destructors to CFGs for all analyses
   -cfg-add-initializers   Add C++ initializers to CFGs for all analyses
   -cfg-dump               Display Control-Flow Graphs
   -cfg-view               View Control-Flow Graphs using GraphViz
   -unoptimized-cfg        Generate unoptimized CFGs for all analyses

All CSA debug checkers can also be invoked using clang -cc1 --analyze. The only thing clang-tidy could bring is a possibility to more easily run all these tools on a file from a project that is using a compilation database. However, that doesn't seem like a very valuable functionality, because 1. working on small artificial test cases (or test cases reduced from real code) is easier, 2. in a rare case when a file from a real project needs to be analyzed, it's possible to get compilation arguments and feed them to clang (e.g. using clang-tidy -extra-arg=-v file.cpp).


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D46188





More information about the cfe-commits mailing list