From: Chris Lattner Date: Mon, 12 Apr 2010 23:04:41 +0000 (+0000) Subject: fix a minor bug I noticed while work with Jordy's patch for PR6101, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=515f43f9f23de50d155b481b8774ec40bdfd7ff2;p=clang 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: # 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 --- 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.