summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2014-02-21 22:49:04 +0000
committerTed Kremenek <kremenek@apple.com>2014-02-21 22:49:04 +0000
commit27cfe10df89937bed1ab1cdab4d701398b05c6c9 (patch)
tree4aa34a50ffc7f646013c8b8981df1542ba270302 /clang/lib
parente87e0343de638536fffebd9086859a03a2d936a4 (diff)
downloadbcm5719-llvm-27cfe10df89937bed1ab1cdab4d701398b05c6c9.tar.gz
bcm5719-llvm-27cfe10df89937bed1ab1cdab4d701398b05c6c9.zip
Add requirement that attribute 'objc_protocol_requires_explicit_implementation' can only be applied to protocol definitions.
llvm-svn: 201899
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 19b79555489..88cdc756ec1 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -1643,8 +1643,14 @@ static void handleAttrWithMessage(Sema &S, Decl *D,
Attr.getAttributeSpellingListIndex()));
}
-static void handleObjCSuppresProtocolAttr(Sema &S, Decl *D,
+static void handleObjCSuppresProtocolAttr(Sema &S, ObjCProtocolDecl *D,
const AttributeList &Attr) {
+ if (!D->isThisDeclarationADefinition()) {
+ S.Diag(Attr.getLoc(), diag::err_objc_attr_protocol_requires_definition)
+ << Attr.getName() << Attr.getRange();
+ return;
+ }
+
D->addAttr(::new (S.Context)
ObjCExplicitProtocolImplAttr(Attr.getRange(), S.Context,
Attr.getAttributeSpellingListIndex()));
@@ -4191,7 +4197,7 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
case AttributeList::AT_ObjCRootClass:
handleSimpleAttribute<ObjCRootClassAttr>(S, D, Attr); break;
case AttributeList::AT_ObjCExplicitProtocolImpl:
- handleObjCSuppresProtocolAttr(S, D, Attr);
+ handleObjCSuppresProtocolAttr(S, cast<ObjCProtocolDecl>(D), Attr);
break;
case AttributeList::AT_ObjCRequiresPropertyDefs:
handleSimpleAttribute<ObjCRequiresPropertyDefsAttr>(S, D, Attr); break;
OpenPOWER on IntegriCloud