]> granicus.if.org Git - clang/commitdiff
Constify ASTContext::getObjContainingInterface
authorDmitri Gribenko <gribozavr@gmail.com>
Sun, 3 Feb 2013 13:23:21 +0000 (13:23 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Sun, 3 Feb 2013 13:23:21 +0000 (13:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174282 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp

index 00af4cb08a15507118389291c6073281f93a8d39..eb14ff5b04b2f2bef5659cbbe5e386a3333d6ac8 100644 (file)
@@ -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);
index 5d155730384f222bf60d0dd250624e5748afeafe..f97e6e9119cca513ac6dd29d9f946684bc67e2d9 100644 (file)
@@ -1805,12 +1805,16 @@ void ASTContext::setObjCImplementation(ObjCCategoryDecl *CatD,
   ObjCImpls[CatD] = ImplD;
 }
 
-ObjCInterfaceDecl *ASTContext::getObjContainingInterface(NamedDecl *ND) const {
-  if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(ND->getDeclContext()))
+const ObjCInterfaceDecl *ASTContext::getObjContainingInterface(
+                                              const NamedDecl *ND) const {
+  if (const ObjCInterfaceDecl *ID =
+          dyn_cast<ObjCInterfaceDecl>(ND->getDeclContext()))
     return ID;
-  if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(ND->getDeclContext()))
+  if (const ObjCCategoryDecl *CD =
+          dyn_cast<ObjCCategoryDecl>(ND->getDeclContext()))
     return CD->getClassInterface();
-  if (ObjCImplDecl *IMD = dyn_cast<ObjCImplDecl>(ND->getDeclContext()))
+  if (const ObjCImplDecl *IMD =
+          dyn_cast<ObjCImplDecl>(ND->getDeclContext()))
     return IMD->getClassInterface();
 
   return 0;