diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2016-10-07 19:25:10 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2016-10-07 19:25:10 +0000 |
commit | b1991c5fa7c813ae3e0b0e34e8ef9f6f6c8c2bd9 (patch) | |
tree | 3798a22ebb6b155112e43774b2624f859a2dc6ab /clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | |
parent | 2620d22b2bbc158981f37213b9a1d7fd4495a135 (diff) | |
download | bcm5719-llvm-b1991c5fa7c813ae3e0b0e34e8ef9f6f6c8c2bd9.tar.gz bcm5719-llvm-b1991c5fa7c813ae3e0b0e34e8ef9f6f6c8c2bd9.zip |
[analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)
The problem that caused the msvc crash has been indentified and fixed
in the previous commit. This patch contains the rest of r283092.
llvm-svn: 283584
Diffstat (limited to 'clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index 3b55a1d6556..8bd0e125b87 100644 --- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -113,16 +113,28 @@ public: Diag.Report(WarnLoc, WarnID) << PD->getShortDescription() << PD->path.back()->getRanges(); + // First, add extra notes, even if paths should not be included. + for (const auto &Piece : PD->path) { + if (!isa<PathDiagnosticNotePiece>(Piece.get())) + continue; + + SourceLocation NoteLoc = Piece->getLocation().asLocation(); + Diag.Report(NoteLoc, NoteID) << Piece->getString() + << Piece->getRanges(); + } + if (!IncludePath) continue; + // Then, add the path notes if necessary. PathPieces FlatPath = PD->path.flatten(/*ShouldFlattenMacros=*/true); - for (PathPieces::const_iterator PI = FlatPath.begin(), - PE = FlatPath.end(); - PI != PE; ++PI) { - SourceLocation NoteLoc = (*PI)->getLocation().asLocation(); - Diag.Report(NoteLoc, NoteID) << (*PI)->getString() - << (*PI)->getRanges(); + for (const auto &Piece : FlatPath) { + if (isa<PathDiagnosticNotePiece>(Piece.get())) + continue; + + SourceLocation NoteLoc = Piece->getLocation().asLocation(); + Diag.Report(NoteLoc, NoteID) << Piece->getString() + << Piece->getRanges(); } } } |