<div dir="ltr">Yeah, looks like it shouldn't be modified.<div><br></div><div>I still think a local fix would be better. As a reader, it's hard to convince myself that the comment is correct:</div><div><div>+  // MSVC: If previous token was pasted, this must be a recovery from an invalid</div><div>+  // paste operation. Ignore spaces before this token to mimic MSVC output.</div><div>+  // Required for generating valid UUID strings in some MS headers.</div></div><div><br></div><div>Why is it that we only come here for invalid token pastes?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 10, 2015 at 2:06 PM, Will Wilson <span dir="ltr"><<a href="mailto:will@indefiant.com" target="_blank">will@indefiant.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Actually looking at the ownership semantics for the TokenLexer::Tokens array, I'd say it has to remain immutable. So modifying RHS looks like a no-go...<span class="HOEnZb"><font color="#888888"><div><br></div><div>- Will.</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 10 April 2015 at 23:03, Will Wilson <span dir="ltr"><<a href="mailto:will@indefiant.com" target="_blank">will@indefiant.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Reid,</div><div><br></div>RHS is a const reference to the Tokens array. So RHS is only mutable if we make some ugly changes... I haven't tried it, but I can if you think it's worth the fallout?<div><br></div><div>- Will.</div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On 10 April 2015 at 21:59, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sure, this is <a href="http://llvm.org/pr23071" target="_blank">http://llvm.org/pr23071</a>.<div><br></div><div>Can this be handled locally by this code?</div><div><div>          // If we're in microsoft extensions mode, downgrade this from a hard</div><div>          // error to an extension that defaults to an error.  This allows</div><div>          // disabling it.</div><div>          PP.Diag(Loc, PP.getLangOpts().MicrosoftExt ? diag::ext_pp_bad_paste_ms</div><div>                                                     : diag::err_pp_bad_paste)</div><div>              << Buffer;</div></div><div><br></div><div>Any reason we can't do RHS.clearFlag(Token::LeadingSpace) here in -fms-extensions mode?</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 10, 2015 at 12:45 PM, Will Wilson <span dir="ltr"><<a href="mailto:will@indefiant.com" target="_blank">will@indefiant.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Reid,
<div><br></div><div>Attached is a patch to handle a corner case supported by MSVC. I decided to attempt to workaround the behaviour in clang after encountering it in public MS headers for XAudio where clang would fail to generate a valid UUID due to the UUID components being combined with the '-' UUID separators. Clang was attempting to recover but would preserve the leading whitespace from the tokens after each failed paste leading to spaces creeping into the UUID and causing an error in the __declspace(uuid()) parsing.</div><div><br></div><div>Reference: Microsoft DirectX SDK (June 2010)\Include\XAudio2.h(51)</div><div><br></div><div>Test case included and tested against latest trunk.</div><div><br></div><div>Let me know if it looks acceptable!</div><div><br></div><div>Cheers,</div><div>Will.</div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div><div dir="ltr"><div><span style="background-color:rgb(255,255,255);color:rgb(68,68,68);font-family:Arial,Helvetica,sans-serif"><b>Indefiant </b>: <a href="http://www.indefiant.com" target="_blank">http://www.indefiant.com</a></span></div><div><span style="font-family:Arial,Helvetica,sans-serif"><font color="#999999">Home of Recode : Runtime C++ Editing for VS</font></span></div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><span style="background-color:rgb(255,255,255);color:rgb(68,68,68);font-family:Arial,Helvetica,sans-serif"><b>Indefiant </b>: <a href="http://www.indefiant.com" target="_blank">http://www.indefiant.com</a></span></div><div><span style="font-family:Arial,Helvetica,sans-serif"><font color="#999999">Home of Recode : Runtime C++ Editing for VS</font></span></div></div></div>
</div>
</div></div></blockquote></div><br></div>