From: Nico Weber Date: Wed, 26 Sep 2012 08:19:01 +0000 (+0000) Subject: Revert r163022, it caused PR13924. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd9602fe935d500d10acde5798ee659488d6921e;p=platform%2Fupstream%2Fllvm.git Revert r163022, it caused PR13924. Add a test for PR13924. Do not revert the test added in r163022, it surprisingly still passes even after reverting the code changes. llvm-svn: 164672 --- diff --git a/clang/include/clang/Lex/Token.h b/clang/include/clang/Lex/Token.h index e422c67..9c5a023 100644 --- a/clang/include/clang/Lex/Token.h +++ b/clang/include/clang/Lex/Token.h @@ -76,8 +76,7 @@ public: 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; } diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index dcaa5a6..1ef534d 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -419,11 +419,7 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName, } } 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. diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index 379b5f3..2e3e7c3 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -225,12 +225,6 @@ void TokenLexer::ExpandFunctionArguments() { 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()) { diff --git a/clang/test/Preprocessor/microsoft-ext.c b/clang/test/Preprocessor/microsoft-ext.c index 5046655..ec10374 100644 --- a/clang/test/Preprocessor/microsoft-ext.c +++ b/clang/test/Preprocessor/microsoft-ext.c @@ -1,6 +1,24 @@ -// 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));