def error_private_ivar_access : Error<"instance variable %0 is private">;
def error_protected_ivar_access : Error<"instance variable %0 is protected">;
def warn_maynot_respond : Warning<"%0 may not respond to %1">;
+def warn_attribute_method_def : Warning<
+ "method attribute may be specified on method declarations only">;
+
}
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)) {
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.
@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.
}
-(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
+