summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Lex/TokenLexer.cpp6
-rw-r--r--clang/test/Preprocessor/assembler-with-cpp.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp
index f1af42aea51..65d083dffdc 100644
--- a/clang/lib/Lex/TokenLexer.cpp
+++ b/clang/lib/Lex/TokenLexer.cpp
@@ -223,7 +223,11 @@ void TokenLexer::ExpandFunctionArguments() {
// If the next token was supposed to get leading whitespace, ensure it has
// it now.
if (CurTok.hasLeadingSpace() || NextTokGetsSpace) {
- ResultToks[ResultToks.size()-NumToks].setFlag(Token::LeadingSpace);
+ // Exception: the RHS of a paste doesn't get whitespace. This allows
+ // constructs like conacatenating a period and an identifer to work
+ // correctly in assembler-with-cpp.
+ if (!PasteBefore)
+ ResultToks[ResultToks.size()-NumToks].setFlag(Token::LeadingSpace);
NextTokGetsSpace = false;
}
continue;
diff --git a/clang/test/Preprocessor/assembler-with-cpp.c b/clang/test/Preprocessor/assembler-with-cpp.c
index 885e67b98c8..bb168805785 100644
--- a/clang/test/Preprocessor/assembler-with-cpp.c
+++ b/clang/test/Preprocessor/assembler-with-cpp.c
@@ -63,4 +63,9 @@ T7(foo)
// RUN: grep 'T6 #nostring' %t &&
// RUN: grep 'T7 "foo"' %t &&
+// Concatenation with period doesn't leave a space
+// RUN: grep '.T8' %t &&
+#define T8(A,B) A ## B
+T8(.,T8)
+
// RUN: true
OpenPOWER on IntegriCloud