Emulate MSVC's preprocessor macro argument separator behavior by not considering commas from nested macro expansions as argument separators. Fixes parsing of VS 2012 headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163022 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp
index 819bb3f..de704ee 100644
--- a/lib/Lex/TokenLexer.cpp
+++ b/lib/Lex/TokenLexer.cpp
@@ -225,6 +225,12 @@
           Token &Tok = ResultToks[i];
           if (Tok.is(tok::hashhash))
             Tok.setKind(tok::unknown);
+          // In Microsoft-compatibility mode, we follow MSVC's preprocessing
+          // behaviour by not considering commas from nested macro expansions
+          // as argument separators. Set a flag on the token so we can test
+          // for this later when the macro expansion is processed.
+          if (Tok.is(tok::comma) && PP.getLangOpts().MicrosoftMode)
+            Tok.setFlag(Token::IgnoredComma);
         }
 
         if(ExpandLocStart.isValid()) {