Improve diagnostics on missing property decl.

llvm-svn: 125752
This commit is contained in:
Fariborz Jahanian 2011-02-17 17:30:05 +00:00
parent a991f3a4e9
commit 5fc74804a6
3 changed files with 4 additions and 3 deletions

View File

@ -2580,7 +2580,8 @@ def err_getter_not_found : Error<
def err_property_not_found_forward_class : Error< def err_property_not_found_forward_class : Error<
"property %0 cannot be found in forward class object %1">; "property %0 cannot be found in forward class object %1">;
def err_property_not_as_forward_class : Error< def err_property_not_as_forward_class : Error<
"property %0 names an object of forward class type in class object %1">; "property %0 refers to an incomplete Objective-C class %1 "
"(with no @interface available)">;
def note_forward_class : Note< def note_forward_class : Note<
"forward class is declared here">; "forward class is declared here">;
def err_duplicate_property : Error< def err_duplicate_property : Error<

View File

@ -530,7 +530,7 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
if (ObjCInterfaceDecl *IFace = IFaceT->getDecl()) if (ObjCInterfaceDecl *IFace = IFaceT->getDecl())
if (IFace->isForwardDecl()) { if (IFace->isForwardDecl()) {
Diag(MemberLoc, diag::err_property_not_as_forward_class) Diag(MemberLoc, diag::err_property_not_as_forward_class)
<< MemberName << QualType(OPT, 0); << MemberName << IFace;
Diag(IFace->getLocation(), diag::note_forward_class); Diag(IFace->getLocation(), diag::note_forward_class);
return ExprError(); return ExprError();
} }

View File

@ -29,6 +29,6 @@ void f3(id o)
@end @end
void foo(MyClass *myObject) { void foo(MyClass *myObject) {
myObject.someOtherObject.someProperty = 0; // expected-error {{property 'someOtherObject' names an object of forward class type in class object 'MyClass *'}} myObject.someOtherObject.someProperty = 0; // expected-error {{property 'someOtherObject' refers to an incomplete Objective-C class 'SomeOtherClass' (with no @interface available)}}
} }