[cfe-commits] r72370 - in /cfe/trunk: lib/Lex/TokenLexer.cpp test/Preprocessor/assembler-with-cpp.c
Eli Friedman
eli.friedman at gmail.com
Sun May 24 12:25:46 PDT 2009
Author: efriedma
Date: Sun May 24 14:25:46 2009
New Revision: 72370
URL: http://llvm.org/viewvc/llvm-project?rev=72370&view=rev
Log:
Make sure an invalid concatentaion doesn't insert whitespace before
the RHS. Fixes assembler-with-cpp issue reported on cfe-dev.
Modified:
cfe/trunk/lib/Lex/TokenLexer.cpp
cfe/trunk/test/Preprocessor/assembler-with-cpp.c
Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=72370&r1=72369&r2=72370&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Sun May 24 14:25:46 2009
@@ -223,7 +223,11 @@
// 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;
Modified: cfe/trunk/test/Preprocessor/assembler-with-cpp.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/assembler-with-cpp.c?rev=72370&r1=72369&r2=72370&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/assembler-with-cpp.c (original)
+++ cfe/trunk/test/Preprocessor/assembler-with-cpp.c Sun May 24 14:25:46 2009
@@ -63,4 +63,9 @@
// 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
More information about the cfe-commits
mailing list