[cfe-dev] Fix for preprocessor paste bug

Richard Smith richard at metafoo.co.uk
Wed Jun 13 00:03:38 PDT 2012


Hi Andy,

On Tue, Jun 12, 2012 at 7:01 AM, Andy Gibbs <andyg1001 at hotmail.co.uk> wrote:

> Attached is a patch fixing a preprocessor paste bug.
>

Great, thanks!


> The bug manifests itself by swallowing up the remainder of the file
> following an invalid paste operation.  In terms of technical details,
> TokenLexer::PasteTokens was returning tok::eof in this case, effectively
> stopping any further processing.  The bug includes a test-case
> demonstrating
> the fix.  No other regressions are noted.


In -fms-extension -Wno-invalid-token-paste mode, the patch regresses this
test, because we're no longer invoking LookUpIdentifierInfo on the pasted
'ab' token:

  #define foo a ## b ## = 0
  int foo;

Switching out the 'return true' for a 'break' should resolve that, I think.
Your fix should also apply in the AsmPreprocessor case.

Can you merge your test case into the existing file?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120613/7d3e9a7b/attachment.html>


More information about the cfe-dev mailing list