Parser: disable lexer diagnostics during delayed parsing.

The lexer diagnostics have already been emitted during token skipping.
This commit is contained in:
Xi Ge
2018-09-11 16:14:50 -07:00
parent b02c7b15a3
commit 0a03259f4a
3 changed files with 16 additions and 3 deletions

View File

@@ -331,12 +331,18 @@ swift::tokenizeWithTrivia(const LangOptions &LangOpts, const SourceManager &SM,
// Setup and Helper Methods
//===----------------------------------------------------------------------===//
Parser::Parser(unsigned BufferID, SourceFile &SF, SILParserTUStateBase *SIL,
PersistentParserState *PersistentState)
: Parser(BufferID, SF, &SF.getASTContext().Diags, SIL, PersistentState) {}
Parser::Parser(unsigned BufferID, SourceFile &SF, DiagnosticEngine* LexerDiags,
SILParserTUStateBase *SIL,
PersistentParserState *PersistentState)
: Parser(
std::unique_ptr<Lexer>(new Lexer(
SF.getASTContext().LangOpts, SF.getASTContext().SourceMgr,
BufferID, &SF.getASTContext().Diags,
BufferID, LexerDiags,
/*InSILMode=*/SIL != nullptr,
SF.Kind == SourceFileKind::Main
? HashbangMode::Allowed