[patch] Microsoft Extension - #pragma message

I implemented this rather simple extension to get more familiar with
the code base. It differs from the MSVC implementation because of the
way clang handles diagnostics. MSVC simply prints _exactly_ what's in
the quoted string to the standard output with a new line at the end.
Because this behavior does not fit in well with the way clang handles
diagnostics, I added a new warning that prints out the quoted string.
This should not {a,e}ffect the correctness of any code, but still
provides the intended functionality.

- Michael Spencer

pragma-message.patch (8.29 KB)

Hi Michael,

Thanks for working on this. This looks good with two minor changes:

1) please drop the testcase into the Lex directory instead of making a new MicrosoftExtensions directory for it. The MS testcases can be found by grepping for ms-extensions.

2) Though it almost certainly isn't a performance issue, for code cleanliness, please change "PragmaMessage" to take a StringRef by value instead of taking a std::string. This will allow PP::HandlePragmaMessage to pass the string directly from the literal parser instead of indirecting through the std::string.

Thanks again,

-Chris

Changes made and new patch attached. Would you like those same changes
made to PragmaComment? That's the style I followed for PragmaMessage.

- Michael Spencer

pragma-message.patch (8.28 KB)

Hi Michael,

Thanks for working on this. This looks good with two minor changes:

1) please drop the testcase into the Lex directory instead of making a new MicrosoftExtensions directory for it. The MS testcases can be found by grepping for ms-extensions.

2) Though it almost certainly isn't a performance issue, for code cleanliness, please change "PragmaMessage" to take a StringRef by value instead of taking a std::string. This will allow PP::HandlePragmaMessage to pass the string directly from the literal parser instead of indirecting through the std::string.

Thanks again,

-Chris

Changes made and new patch attached.

Looks great, applied in r106950, thanks again!

Would you like those same changes
made to PragmaComment? That's the style I followed for PragmaMessage.

Yes please! It looks like it is going back to pre-stringref style. Thanks Michael,

-Chris