Swap InputFileKind for ParseInputMode

Tying InputFile to this option meant that every input that was not one of the explictly-blessed kinds was modeled as a Swift file.

With the new InputFile that infers file kinds, we no longer need CompilerInvocation::setInputKind
This commit is contained in:
Robert Widmann
2020-09-11 21:20:28 -06:00
parent ac0814e4c8
commit 9fd5918786
10 changed files with 28 additions and 42 deletions

View File

@@ -1859,7 +1859,7 @@ CompilerInvocation::setUpInputForSILTool(
// If it looks like we have an AST, set the source file kind to SIL and the
// name of the module to the file's name.
getFrontendOptions().InputsAndOutputs.addInput(
InputFile(inputFilename, bePrimary, fileBufOrErr.get().get()));
InputFile(inputFilename, bePrimary, fileBufOrErr.get().get(), file_types::TY_SIL));
auto result = serialization::validateSerializedAST(
fileBufOrErr.get()->getBuffer(), &extendedInfo);
@@ -1870,13 +1870,14 @@ CompilerInvocation::setUpInputForSILTool(
? moduleNameArg
: llvm::sys::path::stem(inputFilename);
setModuleName(stem);
setInputKind(InputFileKind::SwiftLibrary);
getFrontendOptions().InputMode =
FrontendOptions::ParseInputMode::SwiftLibrary;
} else {
const StringRef name = (alwaysSetModuleToMain || moduleNameArg.empty())
? "main"
: moduleNameArg;
setModuleName(name);
setInputKind(InputFileKind::SIL);
getFrontendOptions().InputMode = FrontendOptions::ParseInputMode::SIL;
}
return fileBufOrErr;
}