[cfe-commits] r38734 - in /cfe/cfe/trunk: Lex/MacroExpander.cpp test/Preprocessor/macro_paste_spacing.c
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:24:12 PDT 2007
Author: sabre
Date: Wed Jul 11 11:24:11 2007
New Revision: 38734
URL: http://llvm.org/viewvc/llvm-project?rev=38734&view=rev
Log:
Fix test/Preprocessor/macro_paste_spacing.c
Added:
cfe/cfe/trunk/test/Preprocessor/macro_paste_spacing.c (with props)
Modified:
cfe/cfe/trunk/Lex/MacroExpander.cpp
Modified: cfe/cfe/trunk/Lex/MacroExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/MacroExpander.cpp?rev=38734&r1=38733&r2=38734&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/MacroExpander.cpp (original)
+++ cfe/cfe/trunk/Lex/MacroExpander.cpp Wed Jul 11 11:24:11 2007
@@ -372,6 +372,10 @@
return PPCache.Lex(Tok);
}
+ // If this is the first token of the expanded result, we inherit spacing
+ // properties later.
+ bool isFirstToken = CurToken == 0;
+
// Get the next token to return.
Tok = (*MacroTokens)[CurToken++];
@@ -395,7 +399,7 @@
// If this is the first token, set the lexical properties of the token to
// match the lexical properties of the macro identifier.
- if (CurToken == 1) {
+ if (isFirstToken) {
Tok.SetFlagValue(LexerToken::StartOfLine , AtStartOfLine);
Tok.SetFlagValue(LexerToken::LeadingSpace, HasLeadingSpace);
}
Added: cfe/cfe/trunk/test/Preprocessor/macro_paste_spacing.c
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/test/Preprocessor/macro_paste_spacing.c?rev=38734&view=auto
==============================================================================
--- cfe/cfe/trunk/test/Preprocessor/macro_paste_spacing.c (added)
+++ cfe/cfe/trunk/test/Preprocessor/macro_paste_spacing.c Wed Jul 11 11:24:11 2007
@@ -0,0 +1,7 @@
+// RUN: clang %s -E | grep "^xy$"
+
+#define A x ## y
+blah
+
+A
+
Propchange: cfe/cfe/trunk/test/Preprocessor/macro_paste_spacing.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/cfe/trunk/test/Preprocessor/macro_paste_spacing.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
More information about the cfe-commits
mailing list