improve the diagnostic for an erroneous objc ivar reference

from:

t.m:8:7: error: member reference is not to a structure or union
  pool->farm = 0;
      ^ ~~~~
to:

t.m:8:7: error: 'NSAutoreleasePool' has member named 'farm'
  pool->farm = 0;
  ~~~~^ ~~~~



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53824 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2008-07-21 04:42:08 +00:00
Родитель 68a057b429
Коммит 1f719747b2
2 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -881,6 +881,8 @@ DIAG(err_typecheck_subscript_not_object, ERROR,
"illegal subscript of non-object type '%0'")
DIAG(err_typecheck_member_reference_structUnion, ERROR,
"member reference is not to a structure or union")
DIAG(err_typecheck_member_reference_ivar, ERROR,
"'%0' has member named '%1'")
DIAG(err_typecheck_member_reference_arrow, ERROR,
"member reference is not a pointer")
DIAG(err_typecheck_incomplete_tag, ERROR,

Просмотреть файл

@ -622,8 +622,9 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
if (ObjCIvarDecl *IV = IFTy->getDecl()->lookupInstanceVariable(&Member))
return new ObjCIvarRefExpr(IV, IV->getType(), MemberLoc, BaseExpr,
OpKind == tok::arrow);
return Diag(OpLoc, diag::err_typecheck_member_reference_structUnion,
SourceRange(MemberLoc));
return Diag(OpLoc, diag::err_typecheck_member_reference_ivar,
IFTy->getDecl()->getName(), Member.getName(),
BaseExpr->getSourceRange(), SourceRange(MemberLoc));
}
// Handle property access.