aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-12-17 01:07:27 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-12-17 01:07:27 +0000
commitbc1c877fe28fb6a825f0b226a0a2da99e713ea03 (patch)
tree5f467bd520f112cca8b35a99c78b88824f80a066 /lib/Sema/SemaDeclObjC.cpp
parentcb73530987a22a6877039b9404b29aba3bf226e0 (diff)
Semantics of @protocol attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 25d1334ab5..b9a63fda26 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -207,7 +207,8 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
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 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
<< 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 @@ Sema::MergeProtocolPropertiesIntoClass(Decl *CDecl,
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 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
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);
}