[cfe-commits] [PATCH] PR7606: Diagnostic for ',' instead of '; ' at the end of a statement

Ahmed Bougacha ahmed.bougacha at gmail.com
Mon Sep 10 11:15:32 PDT 2012


On Thu, Sep 6, 2012 at 1:40 AM, Richard Smith <richard at metafoo.co.uk> wrote:
> Hi,
>
> This patch needs a few more testcases (both positive and negative). I'd
> particularly like tests which cover the places where C++11 allows a braced
> initializer list, since you're using '{' as an indicator of
> not-an-assignment-expression.

We added some testcases.

> Please make isNotExpressionStart be a static function local to
> ParseExpr.cpp, rather than a member of Parser.

This doesn't make much sense anymore, because we added declaration
checking, and isDeclarationStatement() is in Parser.

About declarations, isDeclarationStatement() returns true for "int(f())".
What do you think should be done in that case? For now, we only check
declarations when not parsing C++.

> Also, instead of replacing the ',' with a ';' and producing a diagnostic,
> please just leave the ',' in the token stream and bail out. This will allow
> the appropriate point higher up in the parser to produce the relevant
> diagnostic (which may not be to replace with a semicolon, depending on the
> context). This affects cases like "if (1, {".

Done!

> Thanks!
> Richard

Thank you for your help!

-- 
Amaury de la Vieuville
Ahmed Bougacha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PR7606.patch
Type: application/octet-stream
Size: 3073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120910/a07927e7/attachment.obj>


More information about the cfe-commits mailing list