[cfe-commits] Patch: Fix an edge case where a right parenthesis is consumed early

Chandler Carruth chandlerc at google.com
Thu Jun 30 00:46:24 PDT 2011


On Wed, Jun 29, 2011 at 8:19 PM, Richard Trieu <rtrieu at google.com> wrote:

> The recovery consumes the right parenthesis too early leading to Clang
> thinking there is a parenthesis imbalance when there isn't one.  This patch
> should fix this issue.


I'm not sure this is the correct fix.

Above you change, when ParseExpressionList fails, we
'SkipUntil(tok::r_paren)', and then mark LHS as an error. Then fall through,
and because LHS is now invalid, we 'SkipUntil(tok::r_paren)' a second time.
I think the repeated calls are the problem here.

Because we skip to the r_paren on an invalid LHS, I think we can change the
code to not skip any tokens when ParseExpressionList fails, and just mark
LHS as an error. Falling through, we'll skip to r_paren in the common
location.

Essentially, I'm suggesting we delete line 1263.

If Doug agrees (he's the one who I think understands this part of the parser
the best, and he added that second skip) I've got your test case patched in,
and have made that deletion with some spring cleaning around it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110630/84319a81/attachment.html>


More information about the cfe-commits mailing list