diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-06-12 20:50:44 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-06-12 20:50:44 +0000 |
commit | 5ec0a2613f89f1cccc43f61b3f2987e20d47bed8 (patch) | |
tree | e1645b623e0f6c9b2b5acc2c3efed7797e801816 /clang/lib/StaticAnalyzer/Core/BugReporter.cpp | |
parent | 8b4b82eed471f65c5cfdda12e6e4f7966fe9024e (diff) | |
download | bcm5719-llvm-5ec0a2613f89f1cccc43f61b3f2987e20d47bed8.tar.gz bcm5719-llvm-5ec0a2613f89f1cccc43f61b3f2987e20d47bed8.zip |
[analyzer] [NFC] Remove most usages of getEndPath
getEndPath is a problematic API, because it's not clear when it's called
(hint: not always at the end of the path), it crashes at runtime with
more than one non-nullptr returning implementation, and diagnostics
internal depend on it being called at some exact place.
However, most visitors don't actually need that: all they want is a
function consistently called after all nodes are traversed, to perform
finalization and to decide whether invalidation is needed.
Differential Revision: https://reviews.llvm.org/D48042
llvm-svn: 334540
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp index 98c90559e25..22185d2d038 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1270,7 +1270,9 @@ static bool generatePathDiagnostics( PathDiagnostic &PD, PathDiagnosticBuilder &PDB, const ExplodedNode *N, LocationContextMap &LCM, ArrayRef<std::unique_ptr<BugReporterVisitor>> visitors, + BugReport *R, PathDiagnosticConsumer::PathGenerationScheme ActiveScheme) { + const ExplodedNode *LastNode = N; BugReport *report = PDB.getBugReport(); StackDiagVector CallStack; InterestingExprs IE; @@ -1289,8 +1291,12 @@ static bool generatePathDiagnostics( generatePathDiagnosticsForNode( N, PD, PrevLoc, PDB, LCM, CallStack, IE, AddPathEdges); - if (!NextNode) + if (!NextNode) { + for (auto &V : visitors) { + V->finalizeVisitor(PDB, LastNode, *R); + } continue; + } // Add pieces from custom visitors. llvm::FoldingSet<PathDiagnosticPiece> DeduplicationSet; @@ -2583,7 +2589,7 @@ bool GRBugReporter::generatePathDiagnostic(PathDiagnostic& PD, // hold onto old mappings. LCM.clear(); - generatePathDiagnostics(PD, PDB, N, LCM, visitors, ActiveScheme); + generatePathDiagnostics(PD, PDB, N, LCM, visitors, R, ActiveScheme); // Clean up the visitors we used. visitors.clear(); |