Yeah, looks like it shouldn't be modified. 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? On Fri, Apr 10, 2015 at 2:06 PM, Will Wilson <[email protected]> wrote: > 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... > > - Will. > > On 10 April 2015 at 23:03, Will Wilson <[email protected]> wrote: > >> Hi Reid, >> >> 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? >> >> - Will. >> >> On 10 April 2015 at 21:59, Reid Kleckner <[email protected]> wrote: >> >>> Sure, this is http://llvm.org/pr23071. >>> >>> Can this be handled locally by this code? >>> // If we're in microsoft extensions mode, downgrade this from >>> a hard >>> // error to an extension that defaults to an error. This >>> allows >>> // disabling it. >>> PP.Diag(Loc, PP.getLangOpts().MicrosoftExt ? >>> diag::ext_pp_bad_paste_ms >>> : >>> diag::err_pp_bad_paste) >>> << Buffer; >>> >>> Any reason we can't do RHS.clearFlag(Token::LeadingSpace) here in >>> -fms-extensions mode? >>> >>> On Fri, Apr 10, 2015 at 12:45 PM, Will Wilson <[email protected]> >>> wrote: >>> >>>> Hi Reid, >>>> >>>> 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. >>>> >>>> Reference: Microsoft DirectX SDK (June 2010)\Include\XAudio2.h(51) >>>> >>>> Test case included and tested against latest trunk. >>>> >>>> Let me know if it looks acceptable! >>>> >>>> Cheers, >>>> Will. >>>> >>> >>> >> >> >> -- >> *Indefiant *: http://www.indefiant.com >> Home of Recode : Runtime C++ Editing for VS >> > > > > -- > *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
