[cfe-commits] r53824 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaExpr.cpp
Chris Lattner
sabre at nondot.org
Sun Jul 20 21:42:08 PDT 2008
Author: lattner
Date: Sun Jul 20 23:42:08 2008
New Revision: 53824
URL: http://llvm.org/viewvc/llvm-project?rev=53824&view=rev
Log:
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;
~~~~^ ~~~~
Modified:
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=53824&r1=53823&r2=53824&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Sun Jul 20 23:42:08 2008
@@ -881,6 +881,8 @@
"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,
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=53824&r1=53823&r2=53824&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Jul 20 23:42:08 2008
@@ -622,8 +622,9 @@
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.
More information about the cfe-commits
mailing list