diff --git a/clang/test/Index/invalid-code-rdar_7833619.m b/clang/test/Index/invalid-code-rdar_7833619.m new file mode 100644 index 000000000000..0034539ad102 --- /dev/null +++ b/clang/test/Index/invalid-code-rdar_7833619.m @@ -0,0 +1,4 @@ +// RUN: c-index-test -test-load-source all %s +// All we care about in this test is that it doesn't crash. +typedef r7833619_a (*r7833619_b)(r7833619_c *r7833619_d, r7833619_c *r7833619_e); + diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index 01130e22773d..7a8c78eceae4 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -814,8 +814,9 @@ bool CursorVisitor::VisitFunctionTypeLoc(FunctionTypeLoc TL) { return true; for (unsigned I = 0, N = TL.getNumArgs(); I != N; ++I) - if (Visit(MakeCXCursor(TL.getArg(I), TU))) - return true; + if (Decl *D = TL.getArg(I)) + if (Visit(MakeCXCursor(D, TU))) + return true; return false; }