mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
Improve diagnostic for @property/ivar type mismatch by including the types of the
ivar and @property respectively. llvm-svn: 99312
This commit is contained in:
parent
4d3745ade6
commit
5921b83f54
@ -348,7 +348,7 @@ def error_synthesized_ivar_yet_not_supported : Error<
|
||||
" (need to declare %0 explicitly)">;
|
||||
|
||||
def error_property_ivar_type : Error<
|
||||
"type of property %0 does not match type of ivar %1">;
|
||||
"type of property %0 (%1) does not match type of ivar %2 (%3)">;
|
||||
def error_ivar_in_superclass_use : Error<
|
||||
"property %0 attempting to use ivar %1 declared in super class %2">;
|
||||
def error_weak_property : Error<
|
||||
@ -530,6 +530,7 @@ def err_implicit_object_parameter_init : Error<
|
||||
"of type %1">;
|
||||
|
||||
def note_field_decl : Note<"member is declared here">;
|
||||
def note_ivar_decl : Note<"ivar is declared here">;
|
||||
def note_bitfield_decl : Note<"bit-field is declared here">;
|
||||
def note_previous_decl : Note<"%0 declared here">;
|
||||
def note_member_synthesized_at : Note<
|
||||
|
@ -383,7 +383,9 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
|
||||
if (PropType != IvarType) {
|
||||
if (CheckAssignmentConstraints(PropType, IvarType) != Compatible) {
|
||||
Diag(PropertyLoc, diag::error_property_ivar_type)
|
||||
<< property->getDeclName() << Ivar->getDeclName();
|
||||
<< property->getDeclName() << PropType
|
||||
<< Ivar->getDeclName() << IvarType;
|
||||
Diag(Ivar->getLocation(), diag::note_ivar_decl);
|
||||
// Note! I deliberately want it to fall thru so, we have a
|
||||
// a property implementation and to avoid future warnings.
|
||||
}
|
||||
@ -396,7 +398,9 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
|
||||
if (lhsType != rhsType &&
|
||||
lhsType->isArithmeticType()) {
|
||||
Diag(PropertyLoc, diag::error_property_ivar_type)
|
||||
<< property->getDeclName() << Ivar->getDeclName();
|
||||
<< property->getDeclName() << PropType
|
||||
<< Ivar->getDeclName() << IvarType;
|
||||
Diag(Ivar->getLocation(), diag::note_ivar_decl);
|
||||
// Fall thru - see previous comment
|
||||
}
|
||||
// __weak is explicit. So it works on Canonical type.
|
||||
|
@ -3,12 +3,12 @@
|
||||
|
||||
@interface Test4
|
||||
{
|
||||
char ivar;
|
||||
char ivar; // expected-note{{ivar is declared here}}
|
||||
}
|
||||
@property int prop;
|
||||
@end
|
||||
|
||||
@implementation Test4
|
||||
@synthesize prop = ivar; // expected-error {{type of property 'prop' does not match type of ivar 'ivar'}}
|
||||
@synthesize prop = ivar; // expected-error {{type of property 'prop' ('int') does not match type of ivar 'ivar' ('char')}}
|
||||
@end
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
@interface I
|
||||
{
|
||||
int IVAR;
|
||||
int IVAR; // expected-note{{ivar is declared here}}
|
||||
int name;
|
||||
}
|
||||
@property int d1;
|
||||
@ -19,7 +19,7 @@
|
||||
@synthesize d1; // expected-error {{synthesized property 'd1' must either be named the same as}}
|
||||
@dynamic bad; // expected-error {{property implementation must have its declaration in interface 'I'}}
|
||||
@synthesize prop_id; // expected-error {{synthesized property 'prop_id' must either be named the same}} // expected-note {{previous declaration is here}}
|
||||
@synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' does not match type of ivar 'IVAR'}} // expected-error {{property 'prop_id' is already implemented}}
|
||||
@synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' ('id') does not match type of ivar 'IVAR' ('int')}} // expected-error {{property 'prop_id' is already implemented}}
|
||||
@synthesize name; // OK! property with same name as an accessible ivar of same name
|
||||
@end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user