When copying whitespace flags from the token naming a macro argument onto the

first token of the expansion, don't forget to copy the "is at the start of a
line" token (which is always false, as newlines cannot appear within a macro
body); otherwise, stringizing the result can insert spurious whitespace.

llvm-svn: 257863
This commit is contained in:
Richard Smith 2016-01-15 03:24:18 +00:00
parent 66e5db99b3
commit 4b83886ff1
2 changed files with 7 additions and 0 deletions

View File

@ -305,6 +305,7 @@ void TokenLexer::ExpandFunctionArguments() {
// identifier.
ResultToks[FirstResult].setFlagValue(Token::LeadingSpace,
NextTokGetsSpace);
ResultToks[FirstResult].setFlagValue(Token::StartOfLine, false);
NextTokGetsSpace = false;
}
continue;

View File

@ -12,3 +12,9 @@ c)
// CHECK: {{^}}"a c"{{$}}
#define str(x) #x
#define f(x) str(-x)
f(
1)
// CHECK: {{^}}"-1"