[cfe-commits] r137966 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/SemaCXX/function-redecl.cpp

Chandler Carruth chandlerc at google.com
Thu Aug 18 15:33:04 PDT 2011


On Thu, Aug 18, 2011 at 3:25 PM, Kaelyn Uhrain <rikka at google.com> wrote:

> This is actually a limitation I'm currently aware of, where
> DiagnoseInvalidRedeclaration will correct typos but cannot correct missing
> function qualifiers like "const", and that when both are present the fixit
> doesn't completely fix the code. I feel that, while imperfect, having the
> fixit with this limitation is more beneficial than doing the typo correction
> but not providing any fixit--so that invalid redeclarations that only suffer
> from a mistyped name can be fixed.


No, this really isn't how we want fixit hints to work. When providing a
fixit hint for an *error*, we need to recover the parsing and analyzing as
if that fixit hint had been applied. We don't want to have to iterate to
reach a stable state.


> If the name required typo correction *and* there was some other mismatch
> then there might be something wonkier than a simple typo. If the consensus
> is that the fixit should only be given when it completely fixes any issue
> with the redeclaration I can try to figure out and add the hoops necessary
> to only suggest the fixit if there is a function declaration that exactly
> matches the typo-corrected redeclaration.


Yes, please. The ideal way to do this is to re-do any semantic analysis on
the newly selected redeclaration which already took place on the old one
before deciding it to not match.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110818/085cacee/attachment.html>


More information about the cfe-commits mailing list