Semantics of @protocol attributes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61114 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 25d1334..b9a63fd 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -207,7 +207,8 @@
     PDecl->setForwardDecl(false);
     ObjCProtocols[ProtocolName] = PDecl;
   }
-  
+  if (AttrList)
+    ProcessDeclAttributeList(PDecl, AttrList);
   if (NumProtoRefs) {
     /// Check then save referenced protocols.
     PDecl->addReferencedProtocols((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs);
@@ -233,6 +234,14 @@
         << ProtocolId[i].first;
       continue;
     }
+    for (const Attr *attr = PDecl->getAttrs(); attr; attr = attr->getNext()) {
+      if (attr->hasKind(Attr::Unavailable))
+        Diag(ProtocolId[i].second, diag::warn_unavailable) << 
+          PDecl->getDeclName();
+      if (attr->hasKind(Attr::Deprecated))
+        Diag(ProtocolId[i].second, diag::warn_deprecated) << 
+          PDecl->getDeclName();
+    }
 
     // If this is a forward declaration and we are supposed to warn in this
     // case, do it.
@@ -417,7 +426,8 @@
 Action::DeclTy *
 Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
                                       const IdentifierLocPair *IdentList,
-                                      unsigned NumElts) {
+                                      unsigned NumElts,
+                                      AttributeList *attrList) {
   llvm::SmallVector<ObjCProtocolDecl*, 32> Protocols;
   
   for (unsigned i = 0; i != NumElts; ++i) {
@@ -425,7 +435,8 @@
     ObjCProtocolDecl *&PDecl = ObjCProtocols[Ident];
     if (PDecl == 0) // Not already seen?
       PDecl = ObjCProtocolDecl::Create(Context, IdentList[i].second, Ident);
-    
+    if (attrList)
+      ProcessDeclAttributeList(PDecl, attrList);
     Protocols.push_back(PDecl);
   }