[Frontend] Remove parsing option params from performParseOnly

Lift the `DisablePoundIfEvaluation` parsing option
into `LangOptions` to subsume the need for the
`EvaluateConditionals` parameter, and sink the
computation of `CanDelayBodies` down into
`createSourceFileForMainModule`.
This commit is contained in:
Hamish Knight
2020-06-08 12:44:13 -07:00
parent 81483cc050
commit 5d72c464eb
12 changed files with 47 additions and 33 deletions

View File

@@ -808,6 +808,7 @@ static bool makeParserAST(CompilerInstance &CI, StringRef Text,
Invocation.getFrontendOptions().InputsAndOutputs.clearInputs();
Invocation.setModuleName("main");
Invocation.setInputKind(InputFileKind::Swift);
Invocation.getLangOptions().DisablePoundIfEvaluation = true;
std::unique_ptr<llvm::MemoryBuffer> Buf;
Buf = llvm::MemoryBuffer::getMemBuffer(Text, "<module-interface>");
@@ -1406,7 +1407,7 @@ SourceFile *SwiftLangSupport::getSyntacticSourceFile(
Error = "Compiler invocation set up failed";
return nullptr;
}
ParseCI.performParseOnly(/*EvaluateConditionals*/true);
ParseCI.performParseOnly();
SourceFile *SF = nullptr;
unsigned BufferID = ParseCI.getInputBufferIDs().back();