[cfe-commits] r68283 - /cfe/trunk/lib/Analysis/BugReporter.cpp

Ted Kremenek kremenek at apple.com
Wed Apr 1 20:44:00 PDT 2009


Author: kremenek
Date: Wed Apr  1 22:44:00 2009
New Revision: 68283

URL: http://llvm.org/viewvc/llvm-project?rev=68283&view=rev
Log:
Add another null pointer check.  Simplify condition.

Modified:
    cfe/trunk/lib/Analysis/BugReporter.cpp

Modified: cfe/trunk/lib/Analysis/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BugReporter.cpp?rev=68283&r1=68282&r2=68283&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Wed Apr  1 22:44:00 2009
@@ -806,15 +806,16 @@
         // 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;
+            }
           }
         }
         





More information about the cfe-commits mailing list