From e8dcfef324eb7240381ba9116f21da22fa4fef73 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 19 Jul 2006 05:45:55 +0000 Subject: Fix test/Preprocessor/macro_paste_spacing.c llvm-svn: 38734 --- clang/Lex/MacroExpander.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'clang/Lex/MacroExpander.cpp') diff --git a/clang/Lex/MacroExpander.cpp b/clang/Lex/MacroExpander.cpp index 7d28de546a1..ece0d095085 100644 --- a/clang/Lex/MacroExpander.cpp +++ b/clang/Lex/MacroExpander.cpp @@ -372,6 +372,10 @@ void MacroExpander::Lex(LexerToken &Tok) { 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 @@ void MacroExpander::Lex(LexerToken &Tok) { // 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); } -- cgit v1.2.3