[Serialization] Minor ModuleFile/ModuleFileSharedCore improvements

* Add properties to ModuleFile which holds information from the control
  block.
* 'ExtendedValidationInfo' parameter for 'ModuleFileSharedCore::load()'
  cannot be 'nullptr'. Make it non-defaulted Rvalue reference.
This commit is contained in:
Rintaro Ishizaki
2020-09-01 10:10:03 -07:00
parent e524b1cb62
commit b7c19656ab
5 changed files with 52 additions and 18 deletions

View File

@@ -394,7 +394,7 @@ llvm::ErrorOr<ModuleDependencies> SerializedModuleLoaderBase::scanModuleFile(
nullptr,
nullptr,
isFramework, loadedModuleFile,
&extInfo);
extInfo);
// Map the set of dependencies over to the "module dependencies".
auto dependencies = ModuleDependencies::forSwiftModule(modulePath.str(), isFramework);
@@ -704,19 +704,19 @@ FileUnit *SerializedModuleLoaderBase::loadAST(
std::move(moduleDocInputBuffer),
std::move(moduleSourceInfoInputBuffer),
isFramework, loadedModuleFileCore,
&extendedInfo);
extendedInfo);
if (loadInfo.status == serialization::Status::Valid) {
loadedModuleFile =
std::make_unique<ModuleFile>(std::move(loadedModuleFileCore));
M.setResilienceStrategy(extendedInfo.getResilienceStrategy());
M.setResilienceStrategy(loadedModuleFile->getResilienceStrategy());
// We've loaded the file. Now try to bring it into the AST.
auto fileUnit = new (Ctx) SerializedASTFile(M, *loadedModuleFile);
if (extendedInfo.isTestable())
if (loadedModuleFile->isTestable())
M.setTestingEnabled();
if (extendedInfo.arePrivateImportsEnabled())
if (loadedModuleFile->arePrivateImportsEnabled())
M.setPrivateImportsEnabled();
if (extendedInfo.isImplicitDynamicEnabled())
if (loadedModuleFile->isImplicitDynamicEnabled())
M.setImplicitDynamicEnabled();
auto diagLocOrInvalid = diagLoc.getValueOr(SourceLoc());