mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Serialization: Option to skip writing decls marked @_implementationOnly
This commit is contained in:
@@ -5390,6 +5390,20 @@ bool Serializer::shouldSkipDecl(const Decl *D) const {
|
||||
void Serializer::writeASTBlockEntity(const Decl *D) {
|
||||
using namespace decls_block;
|
||||
|
||||
if (Options.SkipImplementationOnlyDecls) {
|
||||
// Skip @_implementationOnly types.
|
||||
if (D->getAttrs().hasAttribute<ImplementationOnlyAttr>())
|
||||
return;
|
||||
|
||||
// Skip non-public @export(interface) functions.
|
||||
auto FD = dyn_cast<AbstractFunctionDecl>(D);
|
||||
if (FD &&
|
||||
FD->getAttrs().hasAttribute<NeverEmitIntoClientAttr>() &&
|
||||
!FD->getFormalAccessScope(/*useDC*/nullptr,
|
||||
/*treatUsableFromInlineAsPublic*/true).isPublicOrPackage())
|
||||
return;
|
||||
}
|
||||
|
||||
PrettyStackTraceDecl trace("serializing", D);
|
||||
assert(DeclsToSerialize.hasRef(D));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user