summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/AST/NSAPI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/NSAPI.cpp')
-rw-r--r--contrib/llvm/tools/clang/lib/AST/NSAPI.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/NSAPI.cpp b/contrib/llvm/tools/clang/lib/AST/NSAPI.cpp
index a9b10ed..c9264d5 100644
--- a/contrib/llvm/tools/clang/lib/AST/NSAPI.cpp
+++ b/contrib/llvm/tools/clang/lib/AST/NSAPI.cpp
@@ -9,6 +9,7 @@
#include "clang/AST/NSAPI.h"
#include "clang/AST/ASTContext.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "llvm/ADT/StringSwitch.h"
@@ -29,7 +30,6 @@ IdentifierInfo *NSAPI::getNSClassId(NSClassIdKindKind K) const {
"NSMutableDictionary",
"NSNumber",
"NSMutableSet",
- "NSCountedSet",
"NSMutableOrderedSet",
"NSValue"
};
@@ -511,6 +511,26 @@ bool NSAPI::isMacroDefined(StringRef Id) const {
return Ctx.Idents.get(Id).hasMacroDefinition();
}
+bool NSAPI::isSubclassOfNSClass(ObjCInterfaceDecl *InterfaceDecl,
+ NSClassIdKindKind NSClassKind) const {
+ if (!InterfaceDecl) {
+ return false;
+ }
+
+ IdentifierInfo *NSClassID = getNSClassId(NSClassKind);
+
+ bool IsSubclass = false;
+ do {
+ IsSubclass = NSClassID == InterfaceDecl->getIdentifier();
+
+ if (IsSubclass) {
+ break;
+ }
+ } while ((InterfaceDecl = InterfaceDecl->getSuperClass()));
+
+ return IsSubclass;
+}
+
bool NSAPI::isObjCTypedef(QualType T,
StringRef name, IdentifierInfo *&II) const {
if (!Ctx.getLangOpts().ObjC1)
OpenPOWER on IntegriCloud