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

Kaelyn Uhrain rikka at google.com
Thu Oct 31 22:06:36 PDT 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131031/86044fe9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: initial-mistyped-arrow-correction.diff
Type: text/x-patch
Size: 3507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131031/86044fe9/attachment.bin>


More information about the cfe-commits mailing list