From: Ted Kremenek Date: Wed, 26 Sep 2007 21:36:20 +0000 (+0000) Subject: Added extra guard for null Stmt* when traversing the AST using VisitChildren. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c592522b86fa3ea7d5a0f81c186e5ccba41d3b85;p=clang Added extra guard for null Stmt* when traversing the AST using VisitChildren. Added assertion that Block-level statements should not be NULL. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42376 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h b/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h index a17b207777..002c2f0546 100644 --- a/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h +++ b/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h @@ -28,6 +28,8 @@ public: } void BlockStmt_Visit(Stmt* S) { + assert (S); + static_cast< CFGStmtVisitor* >(this)->BlockStmt_Visit(S); static_cast< ImplClass* >(this)->VisitChildren(S); } diff --git a/include/clang/Analysis/Visitors/CFGStmtVisitor.h b/include/clang/Analysis/Visitors/CFGStmtVisitor.h index 86181c8551..afc9873093 100644 --- a/include/clang/Analysis/Visitors/CFGStmtVisitor.h +++ b/include/clang/Analysis/Visitors/CFGStmtVisitor.h @@ -96,7 +96,7 @@ public: /// 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(this)->Visit(*I); + if (*I) static_cast(this)->Visit(*I); } };