diff options
| author | Ted Kremenek <kremenek@apple.com> | 2013-11-23 22:29:11 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2013-11-23 22:29:11 +0000 |
| commit | 7559b47fa2da9bac0baa4fa6662d93868abc92d9 (patch) | |
| tree | a3de94b5b390c0ea2d1f662e0acd2dbb158b65f4 /clang | |
| parent | 33f504328f126a1ddbb35a1f2686c7ccf68c7400 (diff) | |
| download | bcm5719-llvm-7559b47fa2da9bac0baa4fa6662d93868abc92d9.tar.gz bcm5719-llvm-7559b47fa2da9bac0baa4fa6662d93868abc92d9.zip | |
Remove optional parameter bit from attribute ObjCSuppressProtocol.
This refines some diagnostics and reduces some boilerplate checking logic.
llvm-svn: 195560
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Basic/Attr.td | 2 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 3 | ||||
| -rw-r--r-- | clang/test/SemaObjC/protocols-suppress-conformance.m | 4 |
3 files changed, 4 insertions, 5 deletions
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 5902932be2d..ff1d495d670 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -645,7 +645,7 @@ def ObjCRootClass : InheritableAttr { def ObjCSuppressProtocol : InheritableAttr { let Spellings = [GNU<"objc_suppress_protocol_methods">]; let Subjects = [ObjCInterface]; - let Args = [IdentifierArgument<"Protocol", 1>]; + let Args = [IdentifierArgument<"Protocol">]; } def Overloadable : Attr { diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 7ae873d7f9e..5a0b72fcb50 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2142,8 +2142,7 @@ static void handleObjCSuppresProtocolAttr(Sema &S, Decl *D, return; } - IdentifierLoc *Parm = (Attr.getNumArgs() == 1 && Attr.isArgIdent(0)) - ? Attr.getArgAsIdent(0) : 0; + IdentifierLoc *Parm = Attr.isArgIdent(0) ? Attr.getArgAsIdent(0) : 0; if (!Parm) { S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << Attr.getName() << 1; diff --git a/clang/test/SemaObjC/protocols-suppress-conformance.m b/clang/test/SemaObjC/protocols-suppress-conformance.m index 61c950a7b0a..880819e407e 100644 --- a/clang/test/SemaObjC/protocols-suppress-conformance.m +++ b/clang/test/SemaObjC/protocols-suppress-conformance.m @@ -68,8 +68,8 @@ __attribute__((objc_supress_protocol(Protocol))) @interface ClassE (MyCat) @end // expected-error {{attributes may not be specified on a category}} // The attribute requires one or more identifiers. -__attribute__((objc_suppress_protocol_methods())) -@interface ClassF @end // expected-error {{parameter of 'objc_suppress_protocol_methods' attribute must be a single name of an Objective-C protocol}} +__attribute__((objc_suppress_protocol_methods())) // expected-error {{'objc_suppress_protocol_methods' attribute takes one argument}} +@interface ClassF @end // The attribute requires one or more identifiers. __attribute__((objc_suppress_protocol_methods(ProtoA, ProtoB))) // expected-error {{use of undeclared identifier 'ProtoB'}} |

