r195560 - Remove optional parameter bit from attribute ObjCSuppressProtocol.
Ted Kremenek
kremenek at apple.com
Sat Nov 23 14:29:12 PST 2013
Author: kremenek
Date: Sat Nov 23 16:29:11 2013
New Revision: 195560
URL: http://llvm.org/viewvc/llvm-project?rev=195560&view=rev
Log:
Remove optional parameter bit from attribute ObjCSuppressProtocol.
This refines some diagnostics and reduces some boilerplate checking logic.
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=195560&r1=195559&r2=195560&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Sat Nov 23 16:29:11 2013
@@ -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 {
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=195560&r1=195559&r2=195560&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sat Nov 23 16:29:11 2013
@@ -2142,8 +2142,7 @@ static void handleObjCSuppresProtocolAtt
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;
Modified: cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m?rev=195560&r1=195559&r2=195560&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m (original)
+++ cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m Sat Nov 23 16:29:11 2013
@@ -68,8 +68,8 @@ __attribute__((objc_supress_protocol(Pro
@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()))
- at 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}}
+ at interface ClassF @end
// The attribute requires one or more identifiers.
__attribute__((objc_suppress_protocol_methods(ProtoA, ProtoB))) // expected-error {{use of undeclared identifier 'ProtoB'}}
More information about the cfe-commits
mailing list