aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-05-13 07:12:33 +0000
committerTed Kremenek <kremenek@apple.com>2009-05-13 07:12:33 +0000
commit2033a95c9b2692441ce0de790f0d8bbe01722c7f (patch)
treeaf441dd5663d514bfd77bfd08cad78ad40816a20 /lib/Analysis/CFRefCount.cpp
parent766703b76dc1eb0c49d11cafc2a17c7407876ebc (diff)
Fix crasher in CFRefCount.cpp reported by Nikita Zhuk due to recently added autorelease tracking.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r--lib/Analysis/CFRefCount.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index fc6de60032..c31a8cd53d 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -2154,6 +2154,9 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N,
const ExplodedNode<GRState>* PrevN,
BugReporterContext& BRC) {
+ if (!isa<PostStmt>(N->getLocation()))
+ return NULL;
+
// Check if the type state has changed.
GRStateManager &StMgr = BRC.getStateManager();
GRStateRef PrevSt(PrevN->getState(), StMgr);
@@ -2373,8 +2376,8 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N,
if (os.str().empty())
return 0; // We have nothing to say!
-
- Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
+
+ Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
PathDiagnosticLocation Pos(S, BRC.getSourceManager());
PathDiagnosticPiece* P = new PathDiagnosticEventPiece(Pos, os.str());