summaryrefslogtreecommitdiff
path: root/tools/CIndex/CIndexUSRs.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-03-21 10:50:08 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-03-21 10:50:08 +0000
commitc0c7bca4e5b8d12699dc93a0da49e9e4bb79671b (patch)
tree508d4388db78f87d35bf26a0400b4b03bc4c1f13 /tools/CIndex/CIndexUSRs.cpp
parent4a37f65f1c1373c9956d118a012943de2f61edb0 (diff)
Notes
Diffstat (limited to 'tools/CIndex/CIndexUSRs.cpp')
-rw-r--r--tools/CIndex/CIndexUSRs.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/tools/CIndex/CIndexUSRs.cpp b/tools/CIndex/CIndexUSRs.cpp
index 9dbbd3541e4c..8521971a3065 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<ObjCCategoryDecl>(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<ObjCCategoryImplDecl>(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<Decl*>(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);