]> granicus.if.org Git - clang/commit
Introduce caching of diagnostics in BugReporter. This provides extra
authorTed Kremenek <kremenek@apple.com>
Fri, 18 Sep 2009 05:37:41 +0000 (05:37 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 18 Sep 2009 05:37:41 +0000 (05:37 +0000)
commit6a19832d08f00ac78c0a69c4fbe38b04a55b75cc
treeae55168e28cbde260c4cc1958cce3f66c8ffb2ea
parentf1affe6129442b230d3d09b1938e07a7b341a102
Introduce caching of diagnostics in BugReporter.  This provides extra
pruning of diagnostics that may be emitted multiple times.  This is
accomplished by adding FoldingSet profiling support to PathDiagnostic,
and then having BugReporter record what diagnostics have been issued.

This was motived to a serious bug introduced by moving the
'divide-by-zero' checking outside of GRExprEngine into a separate
'Checker' class.  When analyzing code using the '-fobjc-gc' option, a
given function would be analyzed twice, but the second time various
"internal checks" would be disabled to avoid emitting multiple
diagnostics (e.g., "null dereference") for the same issue.  The
problem is that such checks also effect path pruning and don't just
emit diagnostics.  This resulted in an assertion failure involving a
real divide-by-zero in some analyzed code where we would get an
assertion failure in APInt because the 'DivZero' check was disabled
and didn't prune the logic that resulted in the divide-by-zero in the
analyzer.

The implemented solution is somewhat of a hack, and may not perform
extremely well.  This will need to be cleaned up over time.

As a regression test, 'misc-ps.m' has been modified so that its tests
are run using -fobjc-gc to test this diagnostic pruning behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82198 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Analysis/PathDiagnostic.h
lib/Analysis/BugReporter.cpp
lib/Analysis/PathDiagnostic.cpp
lib/Frontend/AnalysisConsumer.cpp
test/Analysis/misc-ps.m