Page MenuHomePhabricator

[analyzer] Make checker silencing work for non-pathsensitive bug reports

Authored by Szelethus on May 21 2021, 5:17 AM.



D66572 separated BugReport and BugReporter into basic and path sensitive versions. As a result, checker silencing, which worked deep in the path sensitive report generation facilities became specific to it. DeadStoresChecker, for instance, despite being in the static analyzer, emits non-pathsensitive reports, and was impossible to silence.

This patch moves the corresponding code before the call to the virtual function generateDiagnosticForConsumerMap (which is overriden by the specific kinds of bug reporters). Although we see bug reporting as relatively lightweight compared to the analysis, this will get rid of several steps we used to throw away.

Quoting from D65379:

At a very high level, this consists of 3 steps:

  1. For all BugReports in the same BugReportEquivClass, collect all their error nodes in a set. With that set, create a new, trimmed ExplodedGraph whose leafs are all error nodes.
  2. Until a valid report is found, construct a bug path, which is yet another ExplodedGraph, that is linear from a given error node to the root of the graph.
  3. Run all visitors on the constructed bug path. If in this process the report got invalidated, start over from step 2.

Checker silencing used to kick in after all of these. Now it does before any of them :^)

Diff Detail

Event Timeline

Szelethus created this revision.May 21 2021, 5:17 AM
Szelethus requested review of this revision.May 21 2021, 5:17 AM
Szelethus edited the summary of this revision. (Show Details)May 21 2021, 5:20 AM
Szelethus updated this revision to Diff 347003.May 21 2021, 5:58 AM

Fix the test file.

martong accepted this revision.Jun 2 2021, 1:46 AM

This makes sense, and looks good to me! Though, my review confidence is weak.

This revision is now accepted and ready to land.Jun 2 2021, 1:46 AM
NoQ accepted this revision.Jun 3 2021, 10:59 PM

Checker silencing used to kick in after all of these. Now it does before any of them :^)

This is probably the main benefit of the patch. Running visitors is cheap most of the time but it can be expensive.

Silencing path-insensitive checkers isn't particularly useful because they don't interact with other checkers so it's entirely equivalent to disabling them. Unless, well, somebody someday introduces an interaction. Still, it's great to have the interface work consistently.

This revision was landed with ongoing or failed builds.Jun 17 2021, 1:28 AM
This revision was automatically updated to reflect the committed changes.