[cfe-dev] My first patch to clang

Chris Lattner clattner at apple.com
Fri Dec 4 15:06:46 PST 2009


On Dec 4, 2009, at 1:20 PM, John McCall wrote:

>
> On Dec 4, 2009, at 8:37 AM, Nicola Gigante wrote:
>
>> Hello,
>>
>> as promised I've started to look at how clang works under the hood.
>>
>> My first "kid job" was to implement a simple diagnostic improvement  
>> that suggests to use -> instead of . if the base expression is a  
>> pointer. You find the patch attached.
>
> Great idea!  We have some similar-in-concept diagnostics/fixits, but  
> not this one specifically.
>
> I see a few issues with this patch, mostly minor.
>
> The first is that we like to have reasonably high confidence in our  
> suggestions.  There are plenty of pointer base types where changing  
> '.' into '->' won't actually help;  for example, int*, struct foo**,  
> etc.  We shouldn't recommend using '->' unless the base is  
> specifically a pointer to a record type.

"pointer to a record type for which the field would be valid".  We  
might as well test that the field makes sense as well.

Thanks again for working on this, it's great to get this enhancement,

-Chris



More information about the cfe-dev mailing list