Eliminate Sema::ObjCImplementations, relying instead on name lookup. What's good for uniformity is good for PCH (or is it the other way around?). 

As part of this, make ObjCImplDecl inherit from NamedDecl (since
ObjCImplementationDecls now need to have names so that they can be
found). This brings ObjCImplDecl very, very close to
ObjCContainerDecl; we may be able to merge them soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69941 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 613c30b..4b5a04b 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -294,8 +294,16 @@
     IDNS = Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Member;
     break;
 
-  case Sema::LookupProtocolName:
-    IDNS = Decl::IDNS_Protocol;
+  case Sema::LookupObjCProtocolName:
+    IDNS = Decl::IDNS_ObjCProtocol;
+    break;
+
+  case Sema::LookupObjCImplementationName:
+    IDNS = Decl::IDNS_ObjCImplementation;
+    break;
+
+  case Sema::LookupObjCCategoryImplName:
+    IDNS = Decl::IDNS_ObjCCategoryImpl;
     break;
   }
   return IDNS;
@@ -836,8 +844,16 @@
       IDNS = Decl::IDNS_Ordinary;
       break;
 
-    case Sema::LookupProtocolName:
-      IDNS = Decl::IDNS_Protocol;
+    case Sema::LookupObjCProtocolName:
+      IDNS = Decl::IDNS_ObjCProtocol;
+      break;
+
+    case Sema::LookupObjCImplementationName:
+      IDNS = Decl::IDNS_ObjCImplementation;
+      break;
+      
+    case Sema::LookupObjCCategoryImplName:
+      IDNS = Decl::IDNS_ObjCCategoryImpl;
       break;
     }
 
@@ -1490,10 +1506,24 @@
 
 /// \brief Find the protocol with the given name, if any.
 ObjCProtocolDecl *Sema::LookupProtocol(IdentifierInfo *II) {
-  Decl *D = LookupName(TUScope, II, LookupProtocolName).getAsDecl();
+  Decl *D = LookupName(TUScope, II, LookupObjCProtocolName).getAsDecl();
   return cast_or_null<ObjCProtocolDecl>(D);
 }
 
+/// \brief Find the Objective-C implementation with the given name, if
+/// any.
+ObjCImplementationDecl *Sema::LookupObjCImplementation(IdentifierInfo *II) {
+  Decl *D = LookupName(TUScope, II, LookupObjCImplementationName).getAsDecl();
+  return cast_or_null<ObjCImplementationDecl>(D);
+}
+
+/// \brief Find the Objective-C category implementation with the given
+/// name, if any.
+ObjCCategoryImplDecl *Sema::LookupObjCCategoryImpl(IdentifierInfo *II) {
+  Decl *D = LookupName(TUScope, II, LookupObjCCategoryImplName).getAsDecl();
+  return cast_or_null<ObjCCategoryImplDecl>(D);
+}
+
 void Sema::LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
                                         QualType T1, QualType T2, 
                                         FunctionSet &Functions) {