[Serialization] Skip opaque types nested in skipped function bodies

Opaque types are gathered and visited separately. As with local types,
only serialize them if they are not within a skipped function body.

Fixes a crash caused when compiling the primary file, where delayed
parsing is explictly disabled.

Resolves rdar://73167790
This commit is contained in:
Ben Barham
2021-01-14 16:37:23 +10:00
parent 727baf19cd
commit fda96eb8a0
2 changed files with 26 additions and 0 deletions

View File

@@ -5273,6 +5273,11 @@ void Serializer::writeAST(ModuleOrSourceFile DC) {
}
for (auto OTD : opaqueReturnTypeDecls) {
// FIXME: We should delay parsing function bodies so these type decls
// don't even get added to the file.
if (OTD->getDeclContext()->getInnermostSkippedFunctionContext())
continue;
hasOpaqueReturnTypes = true;
Mangle::ASTMangler Mangler;
auto MangledName = Mangler.mangleOpaqueTypeDecl(OTD);