]> granicus.if.org Git - clang/commitdiff
Fix for PR4132: make sure to insert whitespace consistently before a
authorEli Friedman <eli.friedman@gmail.com>
Sun, 3 May 2009 19:16:00 +0000 (19:16 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sun, 3 May 2009 19:16:00 +0000 (19:16 +0000)
pasted token.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70793 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/TokenLexer.cpp
test/Preprocessor/macro_paste_spacing2.c [new file with mode: 0644]

index da85a98a199575807f815a629cf10e507676f6fe..af56af6bd395985f554dc501710984380ce44799 100644 (file)
@@ -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 (file)
index 0000000..460b022
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: clang-cc %s -E | grep "movl %eax"
+
+#define R1E %eax
+#define epilogue(r1) movl r1;
+epilogue(R1E)