]> granicus.if.org Git - clang/commit
Allow multiple PathDiagnosticConsumers to be used with a BugReporter at the same...
authorTed Kremenek <kremenek@apple.com>
Thu, 16 Aug 2012 17:45:23 +0000 (17:45 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 16 Aug 2012 17:45:23 +0000 (17:45 +0000)
commitc4bac8e376b98d633bb00ee5f510d5e58449753c
tree713558f6c3fb5128b56028292638b1f8e2731765
parent425f41b370a8795fbca9ffc3b35e9b0ccbb15d97
Allow multiple PathDiagnosticConsumers to be used with a BugReporter at the same time.

This fixes several issues:

- removes egregious hack where PlistDiagnosticConsumer would forward to HTMLDiagnosticConsumer,
but diagnostics wouldn't be generated consistently in the same way if PlistDiagnosticConsumer
was used by itself.

- emitting diagnostics to the terminal (using clang's diagnostic machinery) is no longer a special
case, just another PathDiagnosticConsumer.  This also magically resolved some duplicate warnings,
as we now use PathDiagnosticConsumer's diagnostic pruning, which has scope for the entire translation
unit, not just the scope of a BugReporter (which is limited to a particular ExprEngine).

As an interesting side-effect, diagnostics emitted to the terminal also have their trailing "." stripped,
just like with diagnostics emitted to plists and HTML.  This required some tests to be updated, but now
the tests have higher fidelity with what users will see.

There are some inefficiencies in this patch.  We currently generate the report graph (from the ExplodedGraph)
once per PathDiagnosticConsumer, which is a bit wasteful, but that could be pulled up higher in the
logic stack.  There is some intended duplication, however, as we now generate different PathDiagnostics (for the same issue)
for different PathDiagnosticConsumers.  This is necessary to produce the diagnostics that a particular
consumer expects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162028 91177308-0d34-0410-b5e6-96231b3b80d8
24 files changed:
include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
lib/StaticAnalyzer/Core/AnalysisManager.cpp
lib/StaticAnalyzer/Core/BugReporter.cpp
lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
lib/StaticAnalyzer/Core/PathDiagnostic.cpp
lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
test/Analysis/CFNumber.c
test/Analysis/CheckNSError.m
test/Analysis/array-struct.c
test/Analysis/keychainAPI.m
test/Analysis/malloc-annotations.c
test/Analysis/malloc.c
test/Analysis/misc-ps-region-store.m
test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
test/Analysis/ptr-arith.c
test/Analysis/security-syntax-checks.m
test/Analysis/sizeofpointer.c
test/Analysis/stream.c
test/Analysis/variadic-method-types.m