[PATCH] [ms compatibility] Fix for PR9984.

Alexey Bataev a.bataev at hotmail.com
Thu Dec 11 20:25:55 PST 2014


David, thanks for the review!


================
Comment at: include/clang/Lex/Token.h:69
@@ -68,3 +68,3 @@
   /// Flags - Bits we track about this token, members of the TokenFlags enum.
-  unsigned char Flags;
+  unsigned Flags;
 public:
----------------
majnemer wrote:
> Can we make this `unsigned short` instead?
Yes, of course, I'll do it

================
Comment at: include/clang/Lex/Token.h:268
@@ +267,3 @@
+
+  /// Returns true if this token is formed macro by stringizing or charizing
+  /// operator.
----------------
majnemer wrote:
> is formed by macro
Will be fixed, thanks.

================
Comment at: lib/Lex/TokenLexer.cpp:441
@@ +440,3 @@
+      (Tokens[CurToken].is(tok::hashhash) ||
+       // Special proicessing of L#x macros in -fms-compatibility mode.
+       // Fix for http://llvm.org/PR9984
----------------
majnemer wrote:
> processing
Thanks

================
Comment at: lib/Lex/TokenLexer.cpp:442
@@ +441,3 @@
+       // Special proicessing of L#x macros in -fms-compatibility mode.
+       // Fix for http://llvm.org/PR9984
+       (PP.getLangOpts().MSVCCompat && Tok.is(tok::identifier) &&
----------------
majnemer wrote:
> References to bug reports shouldn't be in the source code.  Instead, I'd have a description of what the special logic is trying to accomplish.
Ok, will be fixed

================
Comment at: lib/Lex/TokenLexer.cpp:443-445
@@ +442,5 @@
+       // Fix for http://llvm.org/PR9984
+       (PP.getLangOpts().MSVCCompat && Tok.is(tok::identifier) &&
+        Tok.getIdentifierInfo()->isStr("L") && Tokens[CurToken].isLiteral() &&
+        Tokens[CurToken].stringifiedInMacro())) &&
+      Macro) {
----------------
majnemer wrote:
> This `if` is getting pretty gnarly, maybe it would be a little cleaner if you broke this logic up a little bit.
Ok, I'll split it

http://reviews.llvm.org/D6604

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






More information about the cfe-commits mailing list