diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-03-19 20:39:03 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-03-19 20:39:03 +0000 |
commit | e184ac5a660c800d960c7a19935a64103ba276f0 (patch) | |
tree | 96da5ea0ec9def23455486941bff313af061b52b /clang/tools/CIndex/CIndex.cpp | |
parent | cf0843ed93d7b83c97e3e5b20ee06c638e138bb6 (diff) | |
download | bcm5719-llvm-e184ac5a660c800d960c7a19935a64103ba276f0.tar.gz bcm5719-llvm-e184ac5a660c800d960c7a19935a64103ba276f0.zip |
Make the CIndex API more resilient to being used on invalid code.
llvm-svn: 98981
Diffstat (limited to 'clang/tools/CIndex/CIndex.cpp')
-rw-r--r-- | clang/tools/CIndex/CIndex.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index f20bb753747..b3c585af37e 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -621,9 +621,10 @@ bool CursorVisitor::VisitObjCImplDecl(ObjCImplDecl *D) { } bool CursorVisitor::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) { - if (Visit(MakeCursorObjCClassRef(D->getCategoryDecl()->getClassInterface(), - D->getLocation(), TU))) - return true; + // 'ID' could be null when dealing with invalid code. + if (ObjCInterfaceDecl *ID = D->getClassInterface()) + if (Visit(MakeCursorObjCClassRef(ID, D->getLocation(), TU))) + return true; return VisitObjCImplDecl(D); } |