AccessControl;
def warn_maynot_respond : Warning<"%0 may not respond to %1">;
def warn_attribute_method_def : Warning<
- "method attribute can only be specified on method declarations">,
+ "attributes on method implementation and its declaration must match">,
InGroup<DiagGroup<"mismatched-method-attributes">>;
def ext_typecheck_base_super : Warning<
"method parameter type %0 does not match "
IMD = IDecl->lookupMethod(ObjCMethod->getSelector(),
ObjCMethod->isInstanceMethod());
if (ObjCMethod->hasAttrs() &&
- containsInvalidMethodImplAttribute(IMD, ObjCMethod->getAttrs()))
+ containsInvalidMethodImplAttribute(IMD, ObjCMethod->getAttrs())) {
Diag(EndLoc, diag::warn_attribute_method_def);
+ Diag(IMD->getLocation(), diag::note_method_declared_at);
+ }
} else {
cast<DeclContext>(ClassDecl)->addDecl(ObjCMethod);
}
@interface INTF
- (int) foo1: (int)arg1 __attribute__((deprecated));
-- (int) foo: (int)arg1;
+- (int) foo: (int)arg1; // expected-note {{method declared here}}
-- (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable));
+- (int) foo2: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{method declared here}}
- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self));
@end
@implementation INTF
-- (int) foo: (int)arg1 __attribute__((deprecated)){ // expected-warning {{method attribute can only be specified}}
+- (int) foo: (int)arg1 __attribute__((deprecated)){ // expected-warning {{attributes on method implementation and its declaration must match}}
return 10;
}
- (int) foo1: (int)arg1 {
return 10;
}
-- (int) foo2: (int)arg1 __attribute__((deprecated)) { // expected-warning {{method attribute can only be specified}}
+- (int) foo2: (int)arg1 __attribute__((deprecated)) { // expected-warning {{attributes on method implementation and its declaration must match}}
return 10;
}
- (int) foo3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) __attribute__((ns_consumes_self)) {return 0; }
- (void) dep __attribute__((deprecated)) { } // OK private methodn
@end
+
+// rdar://10529259
+#define IBAction void)__attribute__((ibaction)
+
+@interface Foo
+- (void)doSomething1:(id)sender;
+- (void)doSomething2:(id)sender; // expected-note {{method declared here}}
+@end
+
+@implementation Foo
+- (void)doSomething1:(id)sender{}
+- (void)doSomething2:(id)sender{}
+@end
+
+@interface Bar : Foo
+- (IBAction)doSomething1:(id)sender;
+@end
+@implementation Bar
+- (IBAction)doSomething1:(id)sender {}
+- (IBAction)doSomething2:(id)sender {} // expected-warning {{attributes on method implementation and its declaration must match}}
+- (IBAction)doSomething3:(id)sender {}
+@end