[cfe-commits] [Patch] Refactor duplicate string literal lexing code in Preprocessor

Eli Friedman eli.friedman at gmail.com
Thu Nov 15 11:03:36 PST 2012


On Thu, Nov 15, 2012 at 9:54 AM, Andy Gibbs <andyg1001 at hotmail.co.uk> wrote:
> Hi,
>
> Attached is a patch that refactors duplicate string literal lexing code
> within Preprocessor, into a common LexStringLiteral function.  In doing so,
> some consistency problems have been ironed out (e.g. where the first token
> in the string literal was lexed with macro expansion, but subsequent ones
> were not) and also an erroneous diagnostic has been corrected (I assume this
> one was caused by some copy-and-paste in the past!).
>
> I have implemented LexStringLiteral with a complementary
> FinishLexStringLiteral function which can be used in the situation where the
> first token of the string literal has already been lexed.
>
> Am I ok to commit this?

It appears your patch makes the diagnostics worse, though; "expected
string literal" is in general a terrible diagnostic because it doesn't
give any context.

Please make sure you have testcases for the bugs you fixed.

Looks fine otherwise.

-Eli



More information about the cfe-commits mailing list