[cfe-commits] [patch] Fixed for function specifiers
Douglas Gregor
dgregor at apple.com
Thu May 14 14:04:46 PDT 2009
On May 14, 2009, at 1:48 PM, Chris Lattner wrote:
>
> On May 14, 2009, at 10:41 AM, Douglas Gregor wrote:
>
>>
>> inline int f(int), g;
>>
>> I suggest that we introduce fix-it hints that remove the erroneous
>> specifier, e.g., for inline on non-functions, use:
>>
>> Diag(D.getIdentifierLoc(), diag::err_inline_non_function)
>> << CodeModificationHint::CreateRemoval(SourceRange(D.getDeclSpec
>> ().getInlineSpecLoc()))
>> << SourceRange(D.getDeclSpec().getInlineSpecLoc());
>>
>
> Why? I think fixit hints should only be used when we really know
> what the user meant. I don't think there is any obvious
> interpretation that the user "accidentally typed inline on a
> variable". If we saw this in practice, we should reject it, but I
> don't think there is a clear indicator of what the user *meant*
Yeah, I jumped the gun here. The SourceRange(D.getDeclSpec
().getInlineSpecLoc()) should remain, so that we highlight the
problematic specifier, but Chris is right: there isn't enough context
here to be sure that eliminating the specifier is the right thing to do.
- Doug
More information about the cfe-commits
mailing list