]> granicus.if.org Git - clang/commitdiff
Check for NULL child expressions before visiting them, as the first
authorChandler Carruth <chandlerc@gmail.com>
Fri, 18 Feb 2011 23:42:00 +0000 (23:42 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 18 Feb 2011 23:42:00 +0000 (23:42 +0000)
thing the visit does is dyn_cast<>, which leads to a nasty segfault.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125993 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/EvaluatedExprVisitor.h

index 5616d8822e53ac64792ce987d5013cff29f78e8e..035f57c12ea7bce767b3cf472e6806c66e7dd611 100644 (file)
@@ -72,7 +72,8 @@ public:
   /// expression, assuming they are all potentially evaluated.
   void VisitStmt(Stmt *S) {
     for (Stmt::child_range C = S->children(); C; ++C)
-      this->Visit(*C);
+      if (*C)
+        this->Visit(*C);
   }
 };