[AST] Add a few parsing flags to SourceFile

Add flags for whether delayed body parsing or #if
condition evaluation is disabled, as well as
whether warnings should be suppressed. Then pass
down these flags from the frontend.

This is in preparation for the requestification of
source file parsing where the SourceFile will need
to be able to parse itself on demand.
This commit is contained in:
Hamish Knight
2020-02-11 15:30:34 -08:00
parent a9870ac787
commit 2ec619caf7
5 changed files with 73 additions and 13 deletions

View File

@@ -1896,10 +1896,11 @@ static void performAutoImport(
SourceFile::SourceFile(ModuleDecl &M, SourceFileKind K,
Optional<unsigned> bufferID,
ImplicitModuleImportKind ModImpKind,
bool KeepParsedTokens, bool BuildSyntaxTree)
: FileUnit(FileUnitKind::Source, M),
BufferID(bufferID ? *bufferID : -1),
Kind(K), SyntaxInfo(new SourceFileSyntaxInfo(BuildSyntaxTree)) {
bool KeepParsedTokens, bool BuildSyntaxTree,
ParsingOptions parsingOpts)
: FileUnit(FileUnitKind::Source, M), BufferID(bufferID ? *bufferID : -1),
ParsingOpts(parsingOpts), Kind(K),
SyntaxInfo(new SourceFileSyntaxInfo(BuildSyntaxTree)) {
M.getASTContext().addDestructorCleanup(*this);
performAutoImport(*this, ModImpKind);