[PATCH] Mimic MSVC whitespace collapse for incompatible token pasting

Reid Kleckner rnk at google.com
Tue Apr 14 11:55:52 PDT 2015


On Mon, Apr 13, 2015 at 4:17 PM, Will Wilson <will at indefiant.com> wrote:

> Hi Reid,
>
> I was going to pick your brain on this in person but it seems you're not
> over in London for the conference. Anyhow, I've tried a few variations but
> I've been unable to find a way to better handle this edge case without
> doing some heavy refactoring.
>
> Do you have fundamental objections to the approach taken (and I admit it's
> not pretty) or is it simply that the comment leaves something to be desired
> - such as a clearer comment?
>

No, not really. Looks like we do this kind of thing elsewhere in the lexer:
    // If we found the stringify operator, get the argument stringified.
The
    // preprocessor already verified that the following token is a macro
name
    // when the #define was parsed.
    const Token &CurTok = Tokens[i];
    if (i != 0 && !Tokens[i-1].is(tok::hashhash) &&
CurTok.hasLeadingSpace())
      NextTokGetsSpace = true;

lgtm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150414/acd72784/attachment.html>


More information about the cfe-commits mailing list