[PATCH] D66042: [analyzer] Analysis: "Disable" core checkers

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 14:15:46 PDT 2019


NoQ added a comment.

In D66042#1625235 <https://reviews.llvm.org/D66042#1625235>, @alexfh wrote:

> In D66042#1624081 <https://reviews.llvm.org/D66042#1624081>, @NoQ wrote:
>
> > + at alexfh because clang-tidy now finally has a way of safely disabling core checkers without causing crashes all over the place! Would you like to take the same approach as we picked in scan-build, i.e. when the user asks to disable a core checker, silence it instead?
>
>
> clang-tidy's native way to enable/disable diagnostics is applied to the static analyzer twice: first time when the list of enabled checkers is created (and then core checkers are always added to that list), and the second time - to each diagnostic generated by the static analyzer (this time the original check name filter is applied, without core checkers). This already works consistently from a user's perspective: https://gcc.godbolt.org/z/MEvSsP
>
> Are there any benefits in using the new CheckerSilenceVector mechanism in clang-tidy?


Wait, you already did that on your own? Nice!! I missed that part. I guess we told you that core checkers need to always be enabled as long as the Static Analyzer is used at all, and you did exactly that. If you already have such silencing mechanism, then i think you won't really benefit from our new mechanism.

----

While we're here: i poked your silencing mechanism a little bit and even though i'm still pretty sure you couldn't have done it perfectly without our help, it sounds as if the only problem you have with it is that the path-sensitive checkers keep running even if only path-insensitive checkers are enabled:

  $ clang-tidy test.c -checks=-*,clang-analyzer-unix.cstring.BadSizeArg -- -Xclang -analyzer-display-progress
  
  ANALYZE (Syntax): /Users/adergachev/test/test.c foo                         // <== only this part will actually influence
                                                                              //     the results of analysis in this invocation
  ANALYZE (Path,  Inline_Regular): /Users/adergachev/test/test.c foo          // <== however this part is sloooooow

This may be a performance issue for users who want fast analysis but are interested in some path-insensitive Static Analyzer checks (and they don't seem to have a way around that when they limit themselves to clang-tidy's own CLI), but apart from that you indeed seem to be fine.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66042/new/

https://reviews.llvm.org/D66042





More information about the cfe-commits mailing list