[analyzer] Improve suppress-on-sink behavior in incomplete analyses.
authorArtem Dergachev <artem.dergachev@gmail.com>
Thu, 22 Dec 2016 14:48:52 +0000 (14:48 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Thu, 22 Dec 2016 14:48:52 +0000 (14:48 +0000)
commit0e0a8b4d85691d23777af21db48e2358bdcf5e79
tree7231b57ea967646959afacf726c8b5793b82d93d
parent4d260bf0c7d3875e8588ee22731f8e354ac3b450
[analyzer] Improve suppress-on-sink behavior in incomplete analyses.

Warnings with suppress-on-sink are discarded during FlushReports when
BugReporter notices that all paths in ExplodedGraph that pass through the
warning eventually run into a sink node.

However, suppress-on-sink fails to filter out false positives when the analysis
terminates too early - by running into analyzer limits, such as block count
limits or graph size limits - and the interruption hits the narrow window
between throwing the leak report and reaching the no-return function call. In
such case the report is there, however suppression-on-sink doesn't work, because
the sink node was never constructed in the incomplete ExplodedGraph.

This patch implements a very partial solution: also suppress reports thrown
against a statement-node that corresponds to a statement that belongs to a
no-return block of the CFG.

rdar://problem/28832541

Differential Revision: https://reviews.llvm.org/D28023

llvm-svn: 290341
clang/lib/StaticAnalyzer/Core/BugReporter.cpp
clang/test/Analysis/max-nodes-suppress-on-sink.c [new file with mode: 0644]