Make ObjCImplDecl inherit from ObjCContainerDecl.

ObjCContainerDecl now is the root class for objc decls that contain methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77235 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index d9005f8..e082a41 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -587,28 +587,6 @@
   return 0;
 }
 
-// getMethod - This method returns an instance/class method by looking in
-// the class implementation. Unlike interfaces, we don't look outside the
-// implementation.
-ObjCMethodDecl *ObjCImplDecl::getMethod(Selector Sel, bool isInstance) const {
-  // Since instance & class methods can have the same name, the loop below
-  // ensures we get the correct method.
-  //
-  // @interface Whatever
-  // - (int) class_method;
-  // + (float) class_method;
-  // @end
-  //
-  lookup_const_iterator Meth, MethEnd;
-  for (llvm::tie(Meth, MethEnd) = lookup(Sel);
-       Meth != MethEnd; ++Meth) {
-    ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(*Meth);
-    if (MD && MD->isInstanceMethod() == isInstance)
-      return MD;
-  }
-  return 0;
-}
-
 //===----------------------------------------------------------------------===//
 // ObjCImplementationDecl
 //===----------------------------------------------------------------------===//
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index 3dbea5e..99a1a16 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -304,10 +304,9 @@
 }
 
 void PCHDeclReader::VisitObjCImplDecl(ObjCImplDecl *D) {
-  VisitNamedDecl(D);
+  VisitObjCContainerDecl(D);
   D->setClassInterface(
               cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
-  D->setLocEnd(SourceLocation::getFromRawEncoding(Record[Idx++]));
 }
 
 void PCHDeclReader::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp
index fba11f8..4239798 100644
--- a/lib/Frontend/PCHWriterDecl.cpp
+++ b/lib/Frontend/PCHWriterDecl.cpp
@@ -297,9 +297,8 @@
 }
 
 void PCHDeclWriter::VisitObjCImplDecl(ObjCImplDecl *D) {
-  VisitNamedDecl(D);
+  VisitObjCContainerDecl(D);
   Writer.AddDeclRef(D->getClassInterface(), Record);
-  Writer.AddSourceLocation(D->getLocEnd(), Record);
   // Abstract class (no need to define a stable pch::DECL code).
 }
 
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 8bd2f53..26f5905 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1555,12 +1555,12 @@
     CDecl->setAtEndLoc(AtEndLoc);
   }
   if (ObjCImplementationDecl *IC=dyn_cast<ObjCImplementationDecl>(ClassDecl)) {
-    IC->setLocEnd(AtEndLoc);
+    IC->setAtEndLoc(AtEndLoc);
     if (ObjCInterfaceDecl* IDecl = IC->getClassInterface())
       ImplMethodsVsClassMethods(IC, IDecl);
   } else if (ObjCCategoryImplDecl* CatImplClass = 
                                    dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) {
-    CatImplClass->setLocEnd(AtEndLoc);
+    CatImplClass->setAtEndLoc(AtEndLoc);
     
     // Find category interface decl and then check that all methods declared
     // in this interface are implemented in the category @implementation.