diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-04-07 00:27:13 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-04-07 00:27:13 +0000 |
commit | 5dbacb4179c759eef36bcaa6466b91518e3b98a9 (patch) | |
tree | d44a2c196808a38a0fa4c47eafbd5426d77fa675 | |
parent | e9f5581ad479e2c53703d5799828399249a4be65 (diff) |
Fix CIndex crash on invalid code reported in <rdar://problem/7833619>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100589 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Index/invalid-code-rdar_7833619.m | 4 | ||||
-rw-r--r-- | tools/CIndex/CIndex.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
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; } |