Make sure an invalid concatentaion doesn't insert whitespace before

the RHS.  Fixes assembler-with-cpp issue reported on cfe-dev.

llvm-svn: 72370
This commit is contained in:
Eli Friedman 2009-05-24 19:25:46 +00:00
parent 4486da5b78
commit 2d49c4f98d
2 changed files with 10 additions and 1 deletions

View File

@ -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;

View File

@ -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