From 1e255aab650a7fa2047fd953cae65b12215280af Mon Sep 17 00:00:00 2001 From: rdivacky Date: Sun, 21 Mar 2010 10:50:08 +0000 Subject: Update clang to r99115. --- tools/CIndex/CIndexUSRs.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'tools/CIndex/CIndexUSRs.cpp') diff --git a/tools/CIndex/CIndexUSRs.cpp b/tools/CIndex/CIndexUSRs.cpp index 9dbbd35..8521971 100644 --- a/tools/CIndex/CIndexUSRs.cpp +++ b/tools/CIndex/CIndexUSRs.cpp @@ -155,14 +155,30 @@ void USRGenerator::VisitObjCContainerDecl(ObjCContainerDecl *D) { break; case Decl::ObjCCategory: { ObjCCategoryDecl *CD = cast(D); - GenObjCCategory(CD->getClassInterface()->getName(), - CD->getName()); + ObjCInterfaceDecl *ID = CD->getClassInterface(); + if (!ID) { + // Handle invalid code where the @interface might not + // have been specified. + // FIXME: We should be able to generate this USR even if the + // @interface isn't available. + IgnoreResults = true; + return; + } + GenObjCCategory(ID->getName(), CD->getName()); break; } case Decl::ObjCCategoryImpl: { ObjCCategoryImplDecl *CD = cast(D); - GenObjCCategory(CD->getClassInterface()->getName(), - CD->getName()); + ObjCInterfaceDecl *ID = CD->getClassInterface(); + if (!ID) { + // Handle invalid code where the @interface might not + // have been specified. + // FIXME: We should be able to generate this USR even if the + // @interface isn't available. + IgnoreResults = true; + return; + } + GenObjCCategory(ID->getName(), CD->getName()); break; } case Decl::ObjCProtocol: @@ -251,7 +267,7 @@ CXString clang_getCursorUSR(CXCursor C) { SUG->Visit(static_cast(D)); if (SUG->ignoreResults() || SUG.str().empty()) - return createCXString(NULL); + return createCXString(""); // Return a copy of the string that must be disposed by the caller. return createCXString(SUG.str(), true); -- cgit v1.1