patch: fix fixit taking address of member and related crash

Nick Lewycky nlewycky at google.com
Wed Jun 11 07:46:20 PDT 2014


The attached patch fixes two bugs in one. We were correcting
address-of-member to use the non-qualified form when it was in scope (ie.,
&Foo::typo became &corrected when we were inside Foo::method). However,
this changes the expression from pointer to member to pointer to T (see
[expr.unary.op]/3). This is fixed by propagating isAddressOfMember through
the correction callback, though we now get an extra leading :: for no good
reason. That is a separate bug, at least.

The crash is because we failed to set a naming class when doing to name
lookup of the member and finding it in a different class. Given
&ValidButWrongOne::member we would start typo correction on "member" and
find &ValidAndRightOne::member, we've got to mark down that the naming
class is now ValidAndRightOne.

Patch attached, please review!

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140611/25ec96d2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr19681.patch
Type: application/octet-stream
Size: 5130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140611/25ec96d2/attachment.obj>


More information about the cfe-commits mailing list