зеркало из https://github.com/microsoft/clang-1.git
improve invalid member reference diagnostics to print the type and
have better source ranges. Before: t.m:11:53: error: member reference is not to a structure or union CGFloat maxOffsetY = [_outlineLayer contentSize].height - [_outlineLayer frame].size.height; ^~~~~~~ after: t.m:11:54: error: member reference base type ('id') is not a structure or union CGFloat maxOffsetY = [_outlineLayer contentSize].height - [_outlineLayer frame].size.height; ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53834 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
c188d308eb
Коммит
2a01b724b6
|
@ -879,8 +879,8 @@ DIAG(err_typecheck_subscript, ERROR,
|
|||
"array subscript is not an integer")
|
||||
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_struct_union, ERROR,
|
||||
"member reference base type ('%0') is not a structure or union")
|
||||
DIAG(err_typecheck_member_reference_ivar, ERROR,
|
||||
"'%0' does not have a member named '%1'")
|
||||
DIAG(err_typecheck_member_reference_arrow, ERROR,
|
||||
|
|
|
@ -588,8 +588,8 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
|
|||
if (const PointerType *PT = BaseType->getAsPointerType())
|
||||
BaseType = PT->getPointeeType();
|
||||
else
|
||||
return Diag(OpLoc, diag::err_typecheck_member_reference_arrow,
|
||||
SourceRange(MemberLoc));
|
||||
return Diag(MemberLoc, diag::err_typecheck_member_reference_arrow,
|
||||
BaseType.getAsString(), BaseExpr->getSourceRange());
|
||||
}
|
||||
|
||||
// Handle field access to simple records. This also handles access to fields
|
||||
|
@ -602,8 +602,8 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
|
|||
// The record definition is complete, now make sure the member is valid.
|
||||
FieldDecl *MemberDecl = RDecl->getMember(&Member);
|
||||
if (!MemberDecl)
|
||||
return Diag(OpLoc, diag::err_typecheck_no_member, Member.getName(),
|
||||
SourceRange(MemberLoc));
|
||||
return Diag(MemberLoc, diag::err_typecheck_no_member, Member.getName(),
|
||||
BaseExpr->getSourceRange());
|
||||
|
||||
// Figure out the type of the member; see C99 6.5.2.3p3
|
||||
// FIXME: Handle address space modifiers
|
||||
|
@ -622,9 +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_ivar,
|
||||
return Diag(MemberLoc, diag::err_typecheck_member_reference_ivar,
|
||||
IFTy->getDecl()->getName(), Member.getName(),
|
||||
BaseExpr->getSourceRange(), SourceRange(MemberLoc));
|
||||
BaseExpr->getSourceRange());
|
||||
}
|
||||
|
||||
// Handle Objective-C property access, which is "Obj.property" where Obj is a
|
||||
|
@ -665,16 +665,16 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
|
|||
// Component access limited to variables (reject vec4.rg.g).
|
||||
if (!isa<DeclRefExpr>(BaseExpr) && !isa<ArraySubscriptExpr>(BaseExpr) &&
|
||||
!isa<ExtVectorElementExpr>(BaseExpr))
|
||||
return Diag(OpLoc, diag::err_ext_vector_component_access,
|
||||
SourceRange(MemberLoc));
|
||||
return Diag(MemberLoc, diag::err_ext_vector_component_access,
|
||||
BaseExpr->getSourceRange());
|
||||
QualType ret = CheckExtVectorComponent(BaseType, OpLoc, Member, MemberLoc);
|
||||
if (ret.isNull())
|
||||
return true;
|
||||
return new ExtVectorElementExpr(ret, BaseExpr, Member, MemberLoc);
|
||||
}
|
||||
|
||||
return Diag(OpLoc, diag::err_typecheck_member_reference_structUnion,
|
||||
SourceRange(MemberLoc));
|
||||
return Diag(MemberLoc, diag::err_typecheck_member_reference_struct_union,
|
||||
BaseType.getAsString(), BaseExpr->getSourceRange());
|
||||
}
|
||||
|
||||
/// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
|
||||
|
|
Загрузка…
Ссылка в новой задаче