aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core
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
commit4ba86bc53bb280ba46a08459eda7d283d513b61f (patch)
treea785de19b6c5d1cafbdb99ca73579574e359eb71 /lib/StaticAnalyzer/Core
parent178a9b8b22cb77b4291bf076c0cd8d6561c7e711 (diff)
[analyzer diagnostics] flush locations *before* popping the current path when visiting a CallEnter.
Fixes <rdar://problem/10967815> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151938 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core')
-rw-r--r--lib/StaticAnalyzer/Core/BugReporter.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp
index 66eb52604d..2b554332ae 100644
--- a/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/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)) {