StmtProfiler: Add a null check for child statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151812 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index 643bca8..d996925 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -69,8 +69,12 @@
void StmtProfiler::VisitStmt(const Stmt *S) {
ID.AddInteger(S->getStmtClass());
- for (Stmt::const_child_range C = S->children(); C; ++C)
- Visit(*C);
+ for (Stmt::const_child_range C = S->children(); C; ++C) {
+ if (*C)
+ Visit(*C);
+ else
+ ID.AddInteger(0);
+ }
}
void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {