"class implementation is declared here">;
def note_class_declared : Note<
"class is declared here">;
+def note_receiver_is_id : Note<
+ "receiver is treated with 'id' type for purpose of method lookup">;
def note_suppressed_class_declare : Note<
"class with specified objc_requires_property_definitions attribute is declared here">;
def warn_dup_category_def : Warning<
"no visible @interface for %0 declares the selector %1">;
def err_arc_receiver_forward_instance : Error<
"receiver type %0 for instance message is a forward declaration">;
+def warn_receiver_forward_instance : Warning<
+ "receiver type %0 for instance message is a forward declaration">,
+ InGroup<DiagGroup<"receiver-forward-class">>, DefaultIgnore;
def err_arc_collection_forward : Error<
"collection expression type %0 is a forward declaration">;
def err_arc_multiple_method_decl : Error<
? PDiag(diag::err_arc_receiver_forward_instance)
<< (Receiver ? Receiver->getSourceRange()
: SourceRange(SuperLoc))
- : PDiag())) {
+ : PDiag(diag::warn_receiver_forward_instance)
+ << (Receiver ? Receiver->getSourceRange()
+ : SourceRange(SuperLoc)))) {
if (getLangOptions().ObjCAutoRefCount)
return ExprError();
forwardClass = OCIType->getInterfaceDecl();
+ Diag(Receiver ? Receiver->getLocStart()
+ : SuperLoc, diag::note_receiver_is_id);
Method = 0;
} else {
Method = ClassDecl->lookupInstanceMethod(Sel);
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -Wreceiver-forward-class -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -Wreceiver-forward-class -verify %s
+// rdar://10686120
+
+@class A; // expected-note {{forward declaration of class here}}
+
+@interface B
+-(int) width; // expected-note {{using}}
+@end
+@interface C
+-(float) width; // expected-note {{also found}}
+@end
+
+int f0(A *x) {
+ return [x width]; // expected-warning {{receiver type 'A' for instance message is a forward declaration}} \
+ // expected-warning {{multiple methods named 'width' found}} \
+ // expected-note {{receiver is treated with 'id' type for purpose of method lookup}}
+}
+