[Serialization] Skip SPI documentation in swiftdoc files

Hide comments from SPI decls in all swiftdoc files. This applies the
same restrictions as private declarations. This is a temporary solution,
a long term fix is to emit both a public and an internal swiftdoc file.

rdar://63729195
This commit is contained in:
Alexis Laferrière
2020-05-27 14:30:34 -07:00
parent b78bd2e061
commit 56c77df926
2 changed files with 20 additions and 3 deletions

View File

@@ -344,6 +344,11 @@ static bool shouldIncludeDecl(Decl *D, bool ExcludeDoubleUnderscore) {
if (VD->getEffectiveAccess() < swift::AccessLevel::Public)
return false;
}
// Skip SPI decls.
if (D->isSPI())
return false;
if (auto *ED = dyn_cast<ExtensionDecl>(D)) {
return shouldIncludeDecl(ED->getExtendedNominal(), ExcludeDoubleUnderscore);
}
@@ -745,7 +750,7 @@ Result.X.Column = Locs->X.Column;
};
// .swiftdoc doesn't include comments for double underscored symbols, but
// for .swiftsourceinfo, having the source location for these symbols isn't
// a concern becuase these symbols are in .swiftinterface anyway.
// a concern because these symbols are in .swiftinterface anyway.
if (!shouldIncludeDecl(D, /*ExcludeDoubleUnderscore*/false))
return false;
if (!shouldSerializeSourceLoc(D))