summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-02 03:44:00 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-02 03:44:00 +0000
commita2a735e7fa865850e64eaf678ef60c08d8b9f37f (patch)
treec24401cd13dacf9693afc8ca755aa311b811cb6e /clang
parent7f905c2f0dd49055108ce515bed3fe8f450aa772 (diff)
downloadbcm5719-llvm-a2a735e7fa865850e64eaf678ef60c08d8b9f37f.tar.gz
bcm5719-llvm-a2a735e7fa865850e64eaf678ef60c08d8b9f37f.zip
Add another null pointer check. Simplify condition.
llvm-svn: 68283
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Analysis/BugReporter.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index 7637a1614c2..2baef5e4bfe 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -806,15 +806,16 @@ static void GenExtAddEdge(PathDiagnostic& PD,
// FIXME: We need a version of getParent that ignores '()' and casts.
const Stmt *parentY = PDB.getParent(Y.asStmt());
- if (IsControlFlowExpr(parentX)) {
- if (IsControlFlowExpr(parentY) && parentX == parentY) {
+ if (parentX && IsControlFlowExpr(parentX)) {
+ if (parentX == parentY)
break;
- }
else {
- const PathDiagnosticLocation &W =
- PDB.getEnclosingStmtLocation(PDB.getParent(parentX));
-
- if (W != Y) X = W;
+ if (const Stmt *grandparentX = PDB.getParent(parentX)) {
+ const PathDiagnosticLocation &W =
+ PDB.getEnclosingStmtLocation(grandparentX);
+
+ if (W != Y) X = W;
+ }
}
}
OpenPOWER on IntegriCloud