From d9b856fddd07b48388307127687a634235271849 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sun, 3 May 2009 19:16:00 +0000 Subject: [PATCH] Fix for PR4132: make sure to insert whitespace consistently before a pasted token. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70793 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/TokenLexer.cpp | 2 +- test/Preprocessor/macro_paste_spacing2.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 test/Preprocessor/macro_paste_spacing2.c diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp index da85a98a19..af56af6bd3 100644 --- a/lib/Lex/TokenLexer.cpp +++ b/lib/Lex/TokenLexer.cpp @@ -222,7 +222,7 @@ void TokenLexer::ExpandFunctionArguments() { // If the next token was supposed to get leading whitespace, ensure it has // it now. - if (NextTokGetsSpace) { + if (CurTok.hasLeadingSpace() || NextTokGetsSpace) { ResultToks[ResultToks.size()-NumToks].setFlag(Token::LeadingSpace); NextTokGetsSpace = false; } diff --git a/test/Preprocessor/macro_paste_spacing2.c b/test/Preprocessor/macro_paste_spacing2.c new file mode 100644 index 0000000000..460b022b37 --- /dev/null +++ b/test/Preprocessor/macro_paste_spacing2.c @@ -0,0 +1,5 @@ +// RUN: clang-cc %s -E | grep "movl %eax" + +#define R1E %eax +#define epilogue(r1) movl r1; +epilogue(R1E)