// Diagnose finding more than one method in global pool
SmallVector<ObjCMethodDecl *, 4> Methods;
Methods.push_back(BestMethod);
- for (ObjCMethodList *M = &MethList; M; M = M->getNext())
- if (M->getMethod() && !M->getMethod()->isHidden() &&
- M->getMethod() != BestMethod)
- Methods.push_back(M->getMethod());
+ for (ObjCMethodList *ML = &MethList; ML; ML = ML->getNext())
+ if (ObjCMethodDecl *M = ML->getMethod())
+ if (!M->isHidden() && M != BestMethod && !M->hasAttr<UnavailableAttr>())
+ Methods.push_back(M);
if (Methods.size() > 1)
DiagnoseMultipleMethodInGlobalPool(Methods, Sel, R, receiverIdOrClass);
bool receiverIdOrClass) {
// We found multiple methods, so we may have to complain.
bool issueDiagnostic = false, issueError = false;
-
+
// We support a warning which complains about *any* difference in
// method signature.
bool strictSelectorMatch =
}
}
}
-
+
// If we didn't see any strict differences, we won't see any loose
// differences. In ARC, however, we also need to check for loose
// mismatches, because most of them are errors.
--- /dev/null
+// RUN: %clang_cc1 -Wobjc-multiple-method-names -x objective-c %s -verify
+// PR22047
+
+@interface Face0
+- (void)foo:(float)i; // expected-note {{using}}
+@end
+
+@interface Face1
+- (void)foo:(int)i __attribute__((unavailable));
+@end
+
+@interface Face2
+- (void)foo:(char)i; // expected-note {{also found}}
+@end
+
+void f(id i) {
+ [i foo:4.0f]; // expected-warning {{multiple methods named 'foo:' found}}
+}
+