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 | 1a9e873bf9b80441ad7f424373f187e0eb9e00e1 (patch) | |
tree | d0707dd44627d49284e09600748dcd2d3a0ff05a /clang/lib/Lex | |
parent | 11862a6ed3447d73d952962b8684d17caf5ec2bd (diff) | |
download | bcm5719-llvm-1a9e873bf9b80441ad7f424373f187e0eb9e00e1.tar.gz bcm5719-llvm-1a9e873bf9b80441ad7f424373f187e0eb9e00e1.zip |
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.
llvm-svn: 101084
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 19f25ea4a8b..74e8d7489e9 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/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. |