aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclObjC.cpp
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
commitebfa339321f8a4df9d5011e591a615d5765107d5 (patch)
tree8e7960f767cecac8de1a7a7e4003c11eb742c6f1 /lib/AST/DeclObjC.cpp
parent86d07a11f164a5dc488842dc932c8fc587b35d4f (diff)
Make the CIndex API more resilient to being used on invalid code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98981 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r--lib/AST/DeclObjC.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 7d1033d4f1..ab6b9e1f45 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/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;
}