[PATCH] [ms compatibility] Fix for PR9984.
Reid Kleckner
rnk at google.com
Fri Dec 12 09:46:34 PST 2014
lgtm
================
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 short Flags;
public:
----------------
OK, I guess either way there is no overall size increase. We could probably pack Kind and Flags more tightly, but that's separable.
================
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) {
----------------
The convention for functions uses a leading lower case.
================
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
----------------
Let's rearrange this to check the Macro bool first so we can short-circuit out with the least amount of work.
http://reviews.llvm.org/D6604
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list