diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -3516,10 +3516,8 @@ /// token, not a normal token, as such, it is an internal interface. It assumes /// that the Flags of result have been cleared before calling this. bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) { -LexNextToken: - // New token, can't need cleaning yet. - Result.clearFlag(Token::NeedsCleaning); - Result.setIdentifierInfo(nullptr); +LexStart: + assert(!Result.needsCleaning() && "Result doesn't need cleaning"); // CurPtr - Cache BufferPtr in an automatic variable. const char *CurPtr = BufferPtr; @@ -4141,8 +4139,9 @@ CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); } else if (Char == '|') { // If this is '|||||||' and we're in a conflict marker, ignore it. - if (CurPtr[1] == '|' && HandleEndOfConflictMarker(CurPtr-1)) + if (CurPtr[1] == '|' && HandleEndOfConflictMarker(CurPtr - 1)) { goto LexNextToken; + } Kind = tok::pipepipe; CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); } else { @@ -4170,8 +4169,9 @@ Char = getCharAndSize(CurPtr, SizeTmp); if (Char == '=') { // If this is '====' and we're in a conflict marker, ignore it. - if (CurPtr[1] == '=' && HandleEndOfConflictMarker(CurPtr-1)) + if (CurPtr[1] == '=' && HandleEndOfConflictMarker(CurPtr - 1)) { goto LexNextToken; + } Kind = tok::equalequal; CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); @@ -4301,6 +4301,10 @@ // We parsed the directive; lex a token with the new state. return false; + +LexNextToken: + Result.clearFlag(Token::NeedsCleaning); + goto LexStart; } const char *Lexer::convertDependencyDirectiveToken(