summaryrefslogtreecommitdiffstats
path: root/clang/lib
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
commit051a03d6987bee541f3a92cd2091d3938bb0f65c (patch)
tree5c53cdb76cfc5f3c51d5ab948b50b7fb1f192360 /clang/lib
parentfce7bc924e190d83d58ea1336310b8b9bdd9cc03 (diff)
downloadbcm5719-llvm-051a03d6987bee541f3a92cd2091d3938bb0f65c.tar.gz
bcm5719-llvm-051a03d6987bee541f3a92cd2091d3938bb0f65c.zip
Fix crasher in CFRefCount.cpp reported by Nikita Zhuk due to recently added autorelease tracking.
llvm-svn: 71647
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index fc6de600321..c31a8cd53d9 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/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());
OpenPOWER on IntegriCloud