[cfe-commits] r125699 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExprObjC.cpp test/SemaObjC/property-missing.m

Ted Kremenek kremenek at apple.com
Wed Feb 16 18:17:36 PST 2011


On Feb 16, 2011, at 6:12 PM, Douglas Gregor wrote:

> 
> On Feb 16, 2011, at 5:59 PM, Ted Kremenek wrote:
> 
>> Hi Fariborz,
>> 
>> I'm not certain this diagnostic is any better:
>> 
>> +	myObject.someOtherObject.someProperty = 0; // expected-error {{property 'someOtherObject' names an object of forward class type in class object 'MyClass *'}}
>> 
>> What is a "forward class type"?  I know what you mean; you're talking about a Objective-C class that has only been forward declared, but there is no such thing as a forward class type.
>> 
>> How about:
>> 
>> property 'someOtherObject' refers to a Objective-C class ('SomeOtherClass') with only a forward declaration (no @interface available)
>> 
>> This diagnostic clearly spells out that (a) no @interface is available for (b) the class SomeOtherClass when (c) accessing the property someOtherObject.
> 
> In the C/C++ world, we would say that the type MyClass is 'incomplete', then point to the forward declaration.
> 
> 	- Doug


That's true, but a strictly "clinical" diagnostic isn't necessarily helpful to the user.  How about:

  property 'someOtherObject' refers to an incomplete Objective-C class 'SomeOtherClass' (with no @interface available)

and then have the note refer to the forward declaration (as it does now)?



More information about the cfe-commits mailing list