From: Ted Kremenek Date: Wed, 7 Apr 2010 00:27:13 +0000 (+0000) Subject: Fix CIndex crash on invalid code reported in . X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5dbacb4179c759eef36bcaa6466b91518e3b98a9;p=clang Fix CIndex crash on invalid code reported in . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100589 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Index/invalid-code-rdar_7833619.m b/test/Index/invalid-code-rdar_7833619.m new file mode 100644 index 0000000000..0034539ad1 --- /dev/null +++ b/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/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index 01130e2277..7a8c78ecea 100644 --- a/tools/CIndex/CIndex.cpp +++ b/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; }