summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/clang/AST/DeclObjC.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index 84e7a63b02..241d76c448 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -629,6 +629,27 @@ public:
return false;
}
+ /// getImmSubClassOf - Returns Immediate sub-class of the specified interface class
+ /// if 'Super' is a superclass of this class. null if no such super class.
+ /// So in this example if 'this' is 'BClass' and 'Super' is 'AClass' then 'BClass'
+ /// is returned.
+ /// \code
+ /// @interface BClass : AClass <SubFooable>
+ /// @end
+ /// \endcode
+
+ ObjCInterfaceDecl *getImmSubClassOf(const ObjCInterfaceDecl *Super) {
+ ObjCInterfaceDecl *ImmSubClass = this;
+ ObjCInterfaceDecl *I = this->getSuperClass();
+ while (I != NULL) {
+ if (Super == I)
+ return ImmSubClass;
+ ImmSubClass = I;
+ I = I->getSuperClass();
+ }
+ return NULL;
+ }
+
ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName,
ObjCInterfaceDecl *&ClassDeclared);
ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName) {