patch: construct correct range when recovering member access as call

Nick Lewycky nlewycky at
Wed Aug 21 12:12:13 PDT 2013

On 21 August 2013 08:53, Matt Beaumont-Gay <matthewbg at> wrote:

> On Wed, Aug 21, 2013 at 12:05 AM, Nick Lewycky <nlewycky at>
> wrote:
> > The attached patch adjusts the RParenLoc (end loc) used in the
> > CXXMemberCallExpr that gets created in the recovery path when we see a
> > non-call member access to a member function. (Ie., "foo->method" missing
> > parenthesis). This is important to get right, or else the text diagnostic
> > printer can assert.
> >
> > The bug is that it places the end sourcelocation at the end of the token
> > (reusing the place where it wrote the fixit for inserting the "()") ,
> > instead of the beginning of the last token.
> Maybe add a comment about why we're not reusing ParenInsertionLoc.

I think that would be excessive. The rule that the end sourcelocation
points to the start of the last token is universal across clang.
ParenInsertionLoc is the weird one, off pointing at the end of a token, but
it's clear why from its excellent name.

FWIW, I'm not sure I understand the bug from the sentence above. Other
> than that, LGTM.

Okay. Thanks for the review! Committed in r188920.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the cfe-commits mailing list