[PATCH] [ms compatibility] Fix for PR9984.

Alexey Bataev a.bataev at hotmail.com
Sun Dec 14 19:40:07 PST 2014


Reid, thanks for the review!


================
Comment at: lib/Lex/TokenLexer.cpp:410
@@ +409,3 @@
+/// \brief Checks if two tokens form wide string literal.
+static bool IsWideStringLiteralFromMacro(const Token &FirstTok,
+                                         const Token &SecondTok) {
----------------
rnk wrote:
> The convention for functions uses a leading lower case.
Ok, fixed.

================
Comment at: lib/Lex/TokenLexer.cpp:448-454
@@ -439,1 +447,9 @@
+  if (!isAtEnd() &&
+      (Tokens[CurToken].is(tok::hashhash) ||
+       // Special processing of L#x macros in -fms-compatibility mode.
+       // Microsoft compiler is able to form a wide string literal from
+       // 'L#macro_arg' construct in a function-like macro.
+       (PP.getLangOpts().MSVCCompat &&
+        IsWideStringLiteralFromMacro(Tok, Tokens[CurToken]))) &&
+      Macro) {
     // When handling the microsoft /##/ extension, the final token is
----------------
rnk wrote:
> Let's rearrange this to check the Macro bool first so we can short-circuit out with the least amount of work.
Agree, fixed

http://reviews.llvm.org/D6604

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list