[cfe-commits] [PATCH] Add suggestion for replacing '.' with '->' in failed member reference

Kaelyn Uhrain rikka at google.com
Tue Apr 24 14:28:40 PDT 2012


This patch adds a suggestion and related fixit for when a member reference
using '.' such as "foo.bar()" fails because bar() is not a member of foo,
but foo defines an operator-> and bar() is a member of the object returned
by foo's operator->. A more concrete case where this is helpful is with
classes like std::shared_ptr or even clang's QualType that have an
operator-> and the user accidentally types "." where they meant to use "->"
(since, you know, the variables in question aren't actually pointers).

I'd like some pre-commit feedback since:
  * while it's a fairly simple patch, there is some ugliness to it for
trying out the correction to see if it causes additional errors,
  * the error text feels a bit verbose, though it's hardly the longest
error message and I can't think of a good way to shorten it, and
  * I am undecided whether there should be an accompanying note, and if so
what the note should refer to.

Thanks,
Kaelyn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120424/723d6f3a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-dot-to-overloaded-arrow-operator.diff
Type: application/octet-stream
Size: 7208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120424/723d6f3a/attachment.obj>


More information about the cfe-commits mailing list