Eliminate Sema::ObjCProtocols. Instead, we place ObjCProtocolDecls in
their own namespace (IDNS_Protocol) and use the normal name-lookup
routines to find them. Aside from the simplification this provides
(one less DenseMap!), it means that protocols will be lazily
deserialized from PCH files.

Make the code size of the selector table block match the code size of
the type and decl blocks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69939 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 0b11d9c..613c30b 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -293,6 +293,10 @@
   case Sema::LookupNamespaceName:
     IDNS = Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Member;
     break;
+
+  case Sema::LookupProtocolName:
+    IDNS = Decl::IDNS_Protocol;
+    break;
   }
   return IDNS;
 }
@@ -831,6 +835,10 @@
         S = S->getParent();
       IDNS = Decl::IDNS_Ordinary;
       break;
+
+    case Sema::LookupProtocolName:
+      IDNS = Decl::IDNS_Protocol;
+      break;
     }
 
     // Scan up the scope chain looking for a decl that matches this
@@ -1480,6 +1488,12 @@
   return false;
 }
 
+/// \brief Find the protocol with the given name, if any.
+ObjCProtocolDecl *Sema::LookupProtocol(IdentifierInfo *II) {
+  Decl *D = LookupName(TUScope, II, LookupProtocolName).getAsDecl();
+  return cast_or_null<ObjCProtocolDecl>(D);
+}
+
 void Sema::LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
                                         QualType T1, QualType T2, 
                                         FunctionSet &Functions) {