Remove optional parameter bit from attribute ObjCSuppressProtocol.

This refines some diagnostics and reduces some boilerplate checking logic.

llvm-svn: 195560
This commit is contained in:
Ted Kremenek 2013-11-23 22:29:11 +00:00
parent 33f504328f
commit 7559b47fa2
3 changed files with 4 additions and 5 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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'}}