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

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 08:31:46 PDT 2019


alexfh added a comment.

In D66042#1625898 <https://reviews.llvm.org/D66042#1625898>, @NoQ wrote:

> 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.


Should this be different with clang and this patch? Unfortunately, it doesn't apply cleanly, and I can't verify. But without this patch clang seems to have the same two ANALYZE log lines regardless of whether I enable `core` checkers or not:

  $ clang -cc1 -analyze -analyzer-checker core,unix.cstring.BadSizeArg -analyzer-display-progress /tmp/q.cc
  /tmp/q.cc:2:12: warning: division by zero is undefined
    (void)(1 / 0);
             ^ ~
  ANALYZE (Syntax): /tmp/q.cc test_disable_core_div_by_zero()
  ANALYZE (Path,  Inline_Regular): /tmp/q.cc test_disable_core_div_by_zero()
  /tmp/q.cc:2:12: warning: Division by zero
    (void)(1 / 0);
           ~~^~~
  2 warnings generated.
  $ clang -cc1 -analyze -analyzer-checker unix.cstring.BadSizeArg -analyzer-display-progress /tmp/q.cc
  /tmp/q.cc:2:12: warning: division by zero is undefined
    (void)(1 / 0);
             ^ ~
  ANALYZE (Syntax): /tmp/q.cc test_disable_core_div_by_zero()
  ANALYZE (Path,  Inline_Regular): /tmp/q.cc test_disable_core_div_by_zero()
  1 warning generated.


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

https://reviews.llvm.org/D66042





More information about the cfe-commits mailing list