[PATCH] [ms compatibility] Fix for PR9984.

David Majnemer david.majnemer at gmail.com
Thu Dec 11 19:24:08 PST 2014


================
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:
----------------
Can we make this `unsigned short` instead?

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

================
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
----------------
processing

================
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) &&
----------------
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.

================
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) {
----------------
This `if` is getting pretty gnarly, maybe it would be a little cleaner if you broke this logic up a little bit.

http://reviews.llvm.org/D6604

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






More information about the cfe-commits mailing list