summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-02-28 23:27:39 +0000
committerTed Kremenek <kremenek@apple.com>2012-02-28 23:27:39 +0000
commit0f70a6f51e7e98c83cf245e358a465d3c32c13a1 (patch)
treed762aa7e08d2179428f666cf955db07ca0eb11a2 /clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
parent2429c6ffe7144df6f63a2d542cd0f1e6964e444a (diff)
downloadbcm5719-llvm-0f70a6f51e7e98c83cf245e358a465d3c32c13a1.tar.gz
bcm5719-llvm-0f70a6f51e7e98c83cf245e358a465d3c32c13a1.zip
[analyzer diagnostics] Refactor filtration for PathDiagnosticConsumers that don't support cross-file diagnostics
into a common place. Currently enable this filtration for Plist diagnostics as well. llvm-svn: 151664
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp35
1 files changed, 7 insertions, 28 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
index 8004ef45a66..3740ba1005b 100644
--- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -145,35 +145,14 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
// First flatten out the entire path to make it easier to use.
PathPieces path;
flattenPath(path, D.path);
-
- const SourceManager &SMgr = (*path.begin())->getLocation().getManager();
- FileID FID;
-
- // Verify that the entire path is from the same FileID.
- for (PathPieces::const_iterator I = path.begin(), E = path.end();
- I != E; ++I) {
- FullSourceLoc L = (*I)->getLocation().asLocation().getExpansionLoc();
-
- if (FID.isInvalid()) {
- FID = SMgr.getFileID(L);
- } else if (SMgr.getFileID(L) != FID)
- return; // FIXME: Emit a warning?
-
- // Check the source ranges.
- for (PathDiagnosticPiece::range_iterator RI = (*I)->ranges_begin(),
- RE = (*I)->ranges_end();
- RI != RE; ++RI) {
- SourceLocation L = SMgr.getExpansionLoc(RI->getBegin());
- if (!L.isFileID() || SMgr.getFileID(L) != FID)
- return; // FIXME: Emit a warning?
- L = SMgr.getExpansionLoc(RI->getEnd());
- if (!L.isFileID() || SMgr.getFileID(L) != FID)
- return; // FIXME: Emit a warning?
- }
- }
- if (FID.isInvalid())
- return; // FIXME: Emit a warning?
+ // The path as already been prechecked that all parts of the path are
+ // from the same file and that it is non-empty.
+ const SourceManager &SMgr = (*path.begin())->getLocation().getManager();
+ assert(!path.empty());
+ FileID FID =
+ (*path.begin())->getLocation().asLocation().getExpansionLoc().getFileID();
+ assert(!FID.isInvalid());
// Create a new rewriter to generate HTML.
Rewriter R(const_cast<SourceManager&>(SMgr), PP.getLangOptions());
OpenPOWER on IntegriCloud