On Tue, May 12, 2009 at 2:36 PM, Fariborz Jahanian <[email protected]> wrote: > +def warn_attribute_method_def : Warning< > + "method attribute may be specified on method declarations only">;
I find this wording easy to misread... what about "method attribute can only be specified on method declarations"? - Daniel > > } > > Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=71597&r1=71596&r2=71597&view=diff > > ============================================================================== > --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue May 12 16:36:23 2009 > @@ -1671,6 +1671,8 @@ > PrevMethod = ImpDecl->getClassMethod(Context, Sel); > ImpDecl->addClassMethod(Context, ObjCMethod); > } > + if (AttrList) > + Diag(EndLoc, diag::warn_attribute_method_def); > } > else if (ObjCCategoryImplDecl *CatImpDecl = > dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) { > @@ -1681,6 +1683,8 @@ > PrevMethod = CatImpDecl->getClassMethod(Context, Sel); > CatImpDecl->addClassMethod(Context, ObjCMethod); > } > + if (AttrList) > + Diag(EndLoc, diag::warn_attribute_method_def); > } > if (PrevMethod) { > // You can never have two method definitions with the same name. > > Modified: cfe/trunk/test/SemaObjC/attr-deprecated.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-deprecated.m?rev=71597&r1=71596&r2=71597&view=diff > > ============================================================================== > --- cfe/trunk/test/SemaObjC/attr-deprecated.m (original) > +++ cfe/trunk/test/SemaObjC/attr-deprecated.m Tue May 12 16:36:23 2009 > @@ -9,7 +9,7 @@ > > �...@implementation A > + (void)F __attribute__((deprecated)) > -{ > +{ // expected-warning {{method attribute may be specified on method > declarations only}} > [self F]; // no warning, since the caller is also deprecated. > } > > > Modified: cfe/trunk/test/SemaObjC/method-attributes.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-attributes.m?rev=71597&r1=71596&r2=71597&view=diff > > ============================================================================== > --- cfe/trunk/test/SemaObjC/method-attributes.m (original) > +++ cfe/trunk/test/SemaObjC/method-attributes.m Tue May 12 16:36:23 2009 > @@ -8,3 +8,25 @@ > -(void) m0 __attribute__((noreturn)); > -(void) m1 __attribute__((unused)); > �...@end > + > + > +...@interface INTF > +- (int) foo1: (int)arg1 __attribute__((deprecated)); > + > +- (int) foo: (int)arg1; > + > +- (int) foo2: (int)arg1 __attribute__((deprecated)) > __attribute__((unavailable)); > +...@end > + > +...@implementation INTF > +- (int) foo: (int)arg1 __attribute__((deprecated)){ // expected-warning > {{method attribute may be specified}} > + return 10; > +} > +- (int) foo1: (int)arg1 { > + return 10; > +} > +- (int) foo2: (int)arg1 __attribute__((deprecated)) { // expected-warning > {{method attribute may be specified}} > + return 10; > +} > +...@end > + > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
