Remove addition of protocol names to declaration scopes, use a separate
DenseMap to keep track of such declarations and derive ObjcProtocolDecl
directyly from NamedScope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42801 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.h b/Sema/Sema.h
index 9baad3a..a442503 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -87,6 +87,11 @@
   /// @implementation's, so that we can emit errors on duplicates.
   llvm::SmallPtrSet<IdentifierInfo*, 8> ObjcImplementations;
   
+  /// ObjcProtocols - Keep track of all protocol declarations declared
+  /// with @protocol keyword, so that we can emit errors on duplicates and
+  /// find the declarations when needded.
+  llvm::DenseMap<IdentifierInfo*, ObjcProtocolDecl*> ObjcProtocols;
+  
   // Enum values used by KnownFunctionIDs (see below).
   enum {
     id_printf,
@@ -195,8 +200,6 @@
   ScopedDecl *LookupScopedDecl(IdentifierInfo *II, unsigned NSI, 
                                SourceLocation IdLoc, Scope *S);  
   ObjcInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *Id);
-  ObjcProtocolDecl *getObjCProtocolDecl(Scope *S, 
-		       IdentifierInfo *Id, SourceLocation IdLoc);
   ScopedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S);
   ScopedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
                                  Scope *S);