From 54d67caeee4fdce81f07163832f1163d5f2af5d2 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 25 Jan 2010 00:40:30 +0000 Subject: CIndex: Don't crash when visitor passes null child statements, and sprinkle some asserts in cursor construction functions to make this more obvious. Doug, please check. c-index-test would previously crash on this code: -- for(;;) {} -- Do we need a custom visit of the for statement to cover the variable declarations? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94391 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/CIndex/CIndex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/CIndex/CIndex.cpp') diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index 84f908d571..4436709f80 100644 --- a/tools/CIndex/CIndex.cpp +++ b/tools/CIndex/CIndex.cpp @@ -783,7 +783,7 @@ bool CursorVisitor::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) { bool CursorVisitor::VisitStmt(Stmt *S) { for (Stmt::child_iterator Child = S->child_begin(), ChildEnd = S->child_end(); Child != ChildEnd; ++Child) { - if (Visit(MakeCXCursor(*Child, StmtParent, TU))) + if (*Child && Visit(MakeCXCursor(*Child, StmtParent, TU))) return true; } -- cgit v1.2.3-70-g09d2