diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-01-25 00:40:30 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-01-25 00:40:30 +0000 |
| commit | 2def7eb3ca88354e31919ce71a81069bc65a4fc1 (patch) | |
| tree | dd0ed98cf9197539e4f6df386585b7e6a7ae9f39 /clang/tools/CIndex/CIndex.cpp | |
| parent | 3e555fd85fcd591484a7e6afb35470c5223c3c37 (diff) | |
| download | bcm5719-llvm-2def7eb3ca88354e31919ce71a81069bc65a4fc1.tar.gz bcm5719-llvm-2def7eb3ca88354e31919ce71a81069bc65a4fc1.zip | |
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?
llvm-svn: 94391
Diffstat (limited to 'clang/tools/CIndex/CIndex.cpp')
| -rw-r--r-- | clang/tools/CIndex/CIndex.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index 84f908d5718..4436709f80c 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/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; } |

