[PATCH] Basic correction of "-" or ">" to "->" (PR9054)

Serge Pavlov sepavloff at gmail.com
Fri Nov 1 00:55:22 PDT 2013


Another approach is to inform Sema about context where the unknown name
occurs. That would allow typo correction code to be gathered in one place
in Sema. Such kind of typos could be processed by the same machinery in
ActOnIdExpression, which now tries to make correction of misspelled names.

There are other typos that are nice to handle ("." vs ".*", dot instead of
comma etc). Handling them in Parser could make the latter bulky.

Thanks,
--Serge


2013/11/1 Kaelyn Uhrain <rikka at google.com>

> Attached is an initial patch for trying to correct a missing "-" or ">" to
> "->" when accessing a member through an object pointer. This patch also
> doesn't work for C code as C seems to hit a different code path. I'm
> sending the patch out for pre-commit review even though it is a small and
> fairly unobtrusive (code-wise) patch because I'm a bit iffy on whether it's
> a good way to perform the diagnostic.
>
> For a bit of context, what makes this diagnostic tricky is that the
> original error about the unknown identifier after the "-" or ">" occurs
> well within Sema as the parser is handling the RHS of a binary operator,
> but the recovery would require following a code path in the parser that was
> part of the construction of the LHS. And since Sema cannot tell the parser
> to back up a few steps....
>
> Cheers,
> Kaelyn
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>


-- 
Thanks,
--Serge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131101/128470cb/attachment.html>


More information about the cfe-commits mailing list