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? - Will. On 11 April 2015 at 01:06, Will Wilson <[email protected]> wrote: > Hi Reid, > > On 11 April 2015 at 00:29, Reid Kleckner <[email protected]> wrote: >> >> I still think a local fix would be better. As a reader, it's hard to >> convince myself that the comment is correct: >> + // MSVC: If previous token was pasted, this must be a recovery from an >> invalid >> + // paste operation. Ignore spaces before this token to mimic MSVC >> output. >> + // Required for generating valid UUID strings in some MS headers. >> >> Why is it that we only come here for invalid token pastes? >> > > The doc for PasteTokens() gives the general premise of the function: > > > Tok is the LHS of a ## operator, and CurToken is the ## > operator. Read the ## and RHS, and paste the LHS/RHS together. If there > are more ## after it, chomp them iteratively. > > Basically, if an invalid paste is attempted, the iteration is aborted and > the concatenated token is returned without doing any more pasting. > Therefore, assuming a successful PasteTokens() call would have consumed all > ## operators, the only reason PasteTokens() would be called with an earlier > ## in the Tokens array would be if the iteration were previously aborted. > At least, this is my understanding of it. > > It's not pretty, but without rewriting the iteration logic to deal cleanly > with the MSVC pasting logic I'm not sure how to improve it... Any ideas? > > - Will. > -- *Indefiant *: http://www.indefiant.com Home of Recode : Runtime C++ Editing for VS
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
