DisableExpand = 0x04, // This identifier may never be macro expanded.
NeedsCleaning = 0x08, // Contained an escaped newline or trigraph.
LeadingEmptyMacro = 0x10, // Empty macro exists before this token.
- HasUDSuffix = 0x20, // This string or character literal has a ud-suffix.
- IgnoredComma = 0x40 // Flags ignored commas from nested macro expansions.
+ HasUDSuffix = 0x20 // This string or character literal has a ud-suffix.
};
tok::TokenKind getKind() const { return (tok::TokenKind)Kind; }
}
} else if (Tok.is(tok::l_paren)) {
++NumParens;
- // In Microsoft-compatibility mode, commas from nested macro expan-
- // sions should not be considered as argument separators. We test
- // for this with the IgnoredComma token flag.
- } else if (Tok.is(tok::comma)
- && !(Tok.getFlags() & Token::IgnoredComma) && NumParens == 0) {
+ } else if (Tok.is(tok::comma) && NumParens == 0) {
// Comma ends this argument if there are more fixed arguments expected.
// However, if this is a variadic macro, and this is part of the
// variadic part, then the comma is just an argument token.
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()) {
-// RUN: %clang_cc1 -E -fms-compatibility %s | FileCheck %s
+// RUN: %clang_cc1 -E -fms-compatibility %s -o %t
+// RUN: FileCheck %s < %t
# define M2(x, y) x + y
# define P(x, y) {x, y}
# define M(x, y) M2(x, P(x, y))
M(a, b) // CHECK: a + {a, b}
+
+// Regression test for PR13924
+#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
+#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
+
+#define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
+
+#define GMOCK_ACTION_CLASS_(name, value_params)\
+ GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
+
+#define ACTION_TEMPLATE(name, template_params, value_params)\
+class GMOCK_ACTION_CLASS_(name, value_params) {\
+}
+
+ACTION_TEMPLATE(InvokeArgument,
+ HAS_1_TEMPLATE_PARAMS(int, k),
+ AND_2_VALUE_PARAMS(p0, p1));