diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-12 23:04:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-12 23:04:41 +0000 |
commit | 515f43f9f23de50d155b481b8774ec40bdfd7ff2 (patch) | |
tree | 71b150d7544f6672664cc6a678778e523a0d0180 /lib/Lex/Lexer.cpp | |
parent | 987aa87cf47811c44ac93afd1913c33f2829ed92 (diff) |
fix a minor bug I noticed while work with Jordy's patch for PR6101,
in an input file like this:
# 42
int x;
we were emitting:
# <something>
int x;
(with a space before the int) because we weren't clearing the leading
whitespace flag properly after the \n from the directive was handled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 19f25ea4a8..74e8d7489e 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -1874,9 +1874,10 @@ LexNextToken: if (PP->isCurrentLexer(this)) { // Start a new token. If this is a #include or something, the PP may // want us starting at the beginning of the line again. If so, set - // the StartOfLine flag. + // the StartOfLine flag and clear LeadingSpace. if (IsAtStartOfLine) { Result.setFlag(Token::StartOfLine); + Result.clearFlag(Token::LeadingSpace); IsAtStartOfLine = false; } goto LexNextToken; // GCC isn't tail call eliminating. @@ -2024,9 +2025,10 @@ LexNextToken: if (PP->isCurrentLexer(this)) { // Start a new token. If this is a #include or something, the PP may // want us starting at the beginning of the line again. If so, set - // the StartOfLine flag. + // the StartOfLine flag and clear LeadingSpace. if (IsAtStartOfLine) { Result.setFlag(Token::StartOfLine); + Result.clearFlag(Token::LeadingSpace); IsAtStartOfLine = false; } goto LexNextToken; // GCC isn't tail call eliminating. |