summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-03-02 21:16:22 +0000
committerTed Kremenek <kremenek@apple.com>2012-03-02 21:16:22 +0000
commitaa1f96add58c968e6693f63bb8ab0df06d175e07 (patch)
tree9aa1489d401bbf80f32a3edb10f7a50ed92e7bd4 /clang/lib/StaticAnalyzer/Core/BugReporter.cpp
parent72ae832f1b63f4c92256b49e5dd5b91c7d5cfab9 (diff)
downloadbcm5719-llvm-aa1f96add58c968e6693f63bb8ab0df06d175e07.tar.gz
bcm5719-llvm-aa1f96add58c968e6693f63bb8ab0df06d175e07.zip
[analyzer diagnostics] flush locations *before* popping the current path when visiting a CallEnter.
Fixes <rdar://problem/10967815> llvm-svn: 151938
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/BugReporter.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
index 66eb52604dd..2b554332aed 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -1229,17 +1229,14 @@ static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD,
PD.pushActivePath(&C->path);
break;
}
-
- // Note that is important that we update the LocationContext
- // after looking at CallExits. CallExit basically adds an
- // edge in the *caller*, so we don't want to update the LocationContext
- // too soon.
- PDB.LC = N->getLocationContext();
-
+
// Pop the call hierarchy if we are done walking the contents
// of a function call.
if (const CallEnter *CE = dyn_cast<CallEnter>(&P)) {
+ EB.flushLocations();
PD.popActivePath();
+ assert(!PD.getActivePath().empty());
+ PDB.LC = N->getLocationContext();
// The current active path should never be empty. Either we
// just added a bunch of stuff to the top-level path, or
// we have a previous CallExit. If the front of the active
@@ -1247,16 +1244,20 @@ static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD,
// path terminated within a function call. We must then take the
// current contents of the active path and place it within
// a new PathDiagnosticCallPiece.
- assert(!PD.getActivePath().empty());
- PathDiagnosticCallPiece *C =
+ PathDiagnosticCallPiece *C =
dyn_cast<PathDiagnosticCallPiece>(PD.getActivePath().front());
if (!C)
C = PathDiagnosticCallPiece::construct(PD.getActivePath());
C->setCallee(*CE, SM);
- EB.flushLocations();
EB.addContext(CE->getCallExpr());
break;
}
+
+ // Note that is important that we update the LocationContext
+ // after looking at CallExits. CallExit basically adds an
+ // edge in the *caller*, so we don't want to update the LocationContext
+ // too soon.
+ PDB.LC = N->getLocationContext();
// Block edges.
if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
OpenPOWER on IntegriCloud