@@ -341,21 +341,15 @@ Parser::Parser(unsigned BufferID, SourceFile &SF, SILParserStateBase *SIL,
341341 PersistentParserState *PersistentState)
342342 : Parser(BufferID, SF, &SF.getASTContext().Diags, SIL, PersistentState) {}
343343
344- Parser::Parser (unsigned BufferID, SourceFile &SF, DiagnosticEngine* LexerDiags,
345- SILParserStateBase *SIL,
346- PersistentParserState *PersistentState)
347- : Parser(
348- std::unique_ptr<Lexer>(new Lexer(
349- SF.getASTContext().LangOpts, SF.getASTContext().SourceMgr,
350- BufferID, LexerDiags,
351- sourceFileKindToLexerMode(SF.Kind),
352- SF.Kind == SourceFileKind::Main
353- ? HashbangMode::Allowed
354- : HashbangMode::Disallowed,
355- SF.getASTContext().LangOpts.AttachCommentsToDecls
356- ? CommentRetentionMode::AttachToNextToken
357- : CommentRetentionMode::None)),
358- SF, SIL, PersistentState) {}
344+ Parser::Parser (unsigned BufferID, SourceFile &SF, DiagnosticEngine *LexerDiags,
345+ SILParserStateBase *SIL, PersistentParserState *PersistentState)
346+ : Parser(std::unique_ptr<Lexer>(new Lexer(
347+ SF.getASTContext().LangOpts, SF.getASTContext().SourceMgr,
348+ BufferID, LexerDiags, sourceFileKindToLexerMode(SF.Kind),
349+ SF.Kind == SourceFileKind::Main ? HashbangMode::Allowed
350+ : HashbangMode::Disallowed,
351+ CommentRetentionMode::AttachToNextToken)),
352+ SF, SIL, PersistentState) {}
359353
360354namespace {
361355
@@ -1243,12 +1237,10 @@ ParserUnit::ParserUnit(SourceManager &SM, SourceFileKind SFKind,
12431237 : Impl(*new Implementation(SM, SFKind, BufferID, LangOptions(), "input")) {
12441238
12451239 std::unique_ptr<Lexer> Lex;
1246- Lex.reset (new Lexer (Impl.LangOpts , SM,
1247- BufferID, &Impl.Diags ,
1248- LexerMode::Swift,
1249- HashbangMode::Allowed,
1250- CommentRetentionMode::None,
1251- Offset, EndOffset));
1240+ Lex.reset (new Lexer (Impl.LangOpts , SM, BufferID, &Impl.Diags ,
1241+ LexerMode::Swift, HashbangMode::Allowed,
1242+ CommentRetentionMode::AttachToNextToken, Offset,
1243+ EndOffset));
12521244 Impl.TheParser .reset (new Parser (std::move (Lex), *Impl.SF , /* SIL=*/ nullptr ,
12531245 /* PersistentState=*/ nullptr ));
12541246}
0 commit comments