[cfe-commits] r42376 - in /cfe/trunk/include/clang/Analysis/Visitors: CFGRecStmtVisitor.h CFGStmtVisitor.h

Ted Kremenek kremenek at apple.com
Wed Sep 26 14:36:20 PDT 2007


Author: kremenek
Date: Wed Sep 26 16:36:20 2007
New Revision: 42376

URL: http://llvm.org/viewvc/llvm-project?rev=42376&view=rev
Log:
Added extra guard for null Stmt* when traversing the AST using VisitChildren.
Added assertion that Block-level statements should not be NULL.

Modified:
    cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h
    cfe/trunk/include/clang/Analysis/Visitors/CFGStmtVisitor.h

Modified: cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h?rev=42376&r1=42375&r2=42376&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h Wed Sep 26 16:36:20 2007
@@ -28,6 +28,8 @@
   }
   
   void BlockStmt_Visit(Stmt* S) {
+    assert (S);
+    
     static_cast< CFGStmtVisitor<ImplClass>* >(this)->BlockStmt_Visit(S);
     static_cast< ImplClass* >(this)->VisitChildren(S);
   }

Modified: cfe/trunk/include/clang/Analysis/Visitors/CFGStmtVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Visitors/CFGStmtVisitor.h?rev=42376&r1=42375&r2=42376&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/Visitors/CFGStmtVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/Visitors/CFGStmtVisitor.h Wed Sep 26 16:36:20 2007
@@ -96,7 +96,7 @@
   /// VisitChildren: Call "Visit" on each child of S.
   void VisitChildren(Stmt* S) {
     for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I != E;++I)
-      static_cast<ImplClass*>(this)->Visit(*I);    
+      if (*I) static_cast<ImplClass*>(this)->Visit(*I);    
   }
 };  
       





More information about the cfe-commits mailing list