[Serialization] Fix crash in reporting missing implementationOnly modules

The diagnostic function crashed as it did not take into account the
DebuggerSupport options as the site reporting the missing dependency did.
In this context, missing implementation-only imported dependencies are
ignored only if DebuggerSupport is set.
This commit is contained in:
Alexis Laferrière
2020-02-05 09:57:36 -08:00
parent 07ade1ddf0
commit 880b8663b9

View File

@@ -738,9 +738,10 @@ void swift::serialization::diagnoseSerializedASTLoadFailure(
std::copy_if(
loadedModuleFile->getDependencies().begin(),
loadedModuleFile->getDependencies().end(), std::back_inserter(missing),
[&duplicates](const ModuleFile::Dependency &dependency) -> bool {
[&duplicates, &Ctx](const ModuleFile::Dependency &dependency) -> bool {
if (dependency.isLoaded() || dependency.isHeader() ||
dependency.isImplementationOnly()) {
(dependency.isImplementationOnly() &&
Ctx.LangOpts.DebuggerSupport)) {
return false;
}
return duplicates.insert(dependency.RawPath).second;