summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-03-19 20:39:03 +0000
committerTed Kremenek <kremenek@apple.com>2010-03-19 20:39:03 +0000
commite184ac5a660c800d960c7a19935a64103ba276f0 (patch)
tree96da5ea0ec9def23455486941bff313af061b52b /clang/lib
parentcf0843ed93d7b83c97e3e5b20ee06c638e138bb6 (diff)
downloadbcm5719-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/lib')
-rw-r--r--clang/lib/AST/DeclObjC.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 7d1033d4f15..ab6b9e1f45a 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -743,7 +743,10 @@ ObjCCategoryImplDecl::Create(ASTContext &C, DeclContext *DC,
}
ObjCCategoryDecl *ObjCCategoryImplDecl::getCategoryDecl() const {
- return getClassInterface()->FindCategoryDeclaration(getIdentifier());
+ // The class interface might be NULL if we are working with invalid code.
+ if (const ObjCInterfaceDecl *ID = getClassInterface())
+ return ID->FindCategoryDeclaration(getIdentifier());
+ return 0;
}
OpenPOWER on IntegriCloud