From: Dmitri Gribenko Date: Sun, 3 Feb 2013 13:23:21 +0000 (+0000) Subject: Constify ASTContext::getObjContainingInterface X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b35cc2d46c4188a0b2d094b3104ce69092c34802;p=clang Constify ASTContext::getObjContainingInterface git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174282 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 00af4cb08a..eb14ff5b04 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -1982,7 +1982,7 @@ public: /// \brief Returns the Objective-C interface that \p ND belongs to if it is /// an Objective-C method/property/ivar etc. that is part of an interface, /// otherwise returns null. - ObjCInterfaceDecl *getObjContainingInterface(NamedDecl *ND) const; + const ObjCInterfaceDecl *getObjContainingInterface(const NamedDecl *ND) const; /// \brief Set the copy inialization expression of a block var decl. void setBlockVarCopyInits(VarDecl*VD, Expr* Init); diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 5d15573038..f97e6e9119 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1805,12 +1805,16 @@ void ASTContext::setObjCImplementation(ObjCCategoryDecl *CatD, ObjCImpls[CatD] = ImplD; } -ObjCInterfaceDecl *ASTContext::getObjContainingInterface(NamedDecl *ND) const { - if (ObjCInterfaceDecl *ID = dyn_cast(ND->getDeclContext())) +const ObjCInterfaceDecl *ASTContext::getObjContainingInterface( + const NamedDecl *ND) const { + if (const ObjCInterfaceDecl *ID = + dyn_cast(ND->getDeclContext())) return ID; - if (ObjCCategoryDecl *CD = dyn_cast(ND->getDeclContext())) + if (const ObjCCategoryDecl *CD = + dyn_cast(ND->getDeclContext())) return CD->getClassInterface(); - if (ObjCImplDecl *IMD = dyn_cast(ND->getDeclContext())) + if (const ObjCImplDecl *IMD = + dyn_cast(ND->getDeclContext())) return IMD->getClassInterface(); return 0;