Index: include/clang/AST/DeclObjC.h =================================================================== --- include/clang/AST/DeclObjC.h +++ include/clang/AST/DeclObjC.h @@ -1852,7 +1852,8 @@ return lookupMethod(Sel, false/*isInstance*/); } - ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName); + const ObjCInterfaceDecl * + lookupInheritedClass(const IdentifierInfo *ICName) const; /// Lookup a method in the classes implementation hierarchy. ObjCMethodDecl *lookupPrivateMethod(const Selector &Sel, Index: lib/AST/DeclObjC.cpp =================================================================== --- lib/AST/DeclObjC.cpp +++ lib/AST/DeclObjC.cpp @@ -646,10 +646,10 @@ } /// lookupInheritedClass - This method returns ObjCInterfaceDecl * of the super -/// class whose name is passed as argument. If it is not one of the super classes -/// the it returns NULL. -ObjCInterfaceDecl *ObjCInterfaceDecl::lookupInheritedClass( - const IdentifierInfo*ICName) { +/// class whose name is passed as argument. If it is not one of the super +/// classes then it returns NULL. +const ObjCInterfaceDecl * +ObjCInterfaceDecl::lookupInheritedClass(const IdentifierInfo *ICName) const { // FIXME: Should make sure no callers ever do this. if (!hasDefinition()) return nullptr; @@ -657,7 +657,7 @@ if (data().ExternallyCompleted) LoadExternalDefinition(); - ObjCInterfaceDecl* ClassDecl = this; + auto *ClassDecl = this; while (ClassDecl != nullptr) { if (ClassDecl->getIdentifier() == ICName) return ClassDecl; Index: lib/Sema/SemaDeclObjC.cpp =================================================================== --- lib/Sema/SemaDeclObjC.cpp +++ lib/Sema/SemaDeclObjC.cpp @@ -2685,7 +2685,7 @@ assert (IDecl && "CheckProtocolMethodDefs - IDecl is null"); ObjCInterfaceDecl *Super = IDecl->getSuperClass(); - ObjCInterfaceDecl *NSIDecl = nullptr; + const ObjCInterfaceDecl *NSIDecl = nullptr; // If this protocol is marked 'objc_protocol_requires_explicit_implementation' // then we should check if any class in the super class hierarchy also