Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/AST/DeclAttr.def
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ SIMPLE_DECL_ATTR(_alwaysEmitIntoClient, AlwaysEmitIntoClient,
83)

SIMPLE_DECL_ATTR(_implementationOnly, ImplementationOnly,
OnImport | OnFunc | OnConstructor | OnVar | OnSubscript | OnStruct | OnClass | OnEnum,
OnImport | OnFunc | OnConstructor | OnVar | OnSubscript | OnNominalType,
UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove | UnreachableInABIAttr,
84)

Expand Down
14 changes: 7 additions & 7 deletions lib/Sema/TypeCheckAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2163,13 +2163,13 @@ swift::getDisallowedOriginKind(const Decl *decl,
Feature::AssumeResilientCxxTypes))
return DisallowedOriginKind::FragileCxxAPI;

if (isa<StructDecl>(decl) || isa<EnumDecl>(decl)) {
if (decl->getASTContext().LangOpts.hasFeature(
Feature::CheckImplementationOnly) &&
decl->getAttrs().hasAttribute<ImplementationOnlyAttr>()) {
return DisallowedOriginKind::ImplementationOnlyMemoryLayout;
}
}
// Implementation-only memory layouts for non-library-evolution mode.
// Should we allow references to classes and protocols in non-embedded mode?
if (isa<NominalTypeDecl>(decl) &&
decl->getASTContext().LangOpts.hasFeature(
Feature::CheckImplementationOnly) &&
decl->getAttrs().hasAttribute<ImplementationOnlyAttr>())
return DisallowedOriginKind::ImplementationOnlyMemoryLayout;

// Report non-public import last as it can be ignored by the caller.
// See \c diagnoseValueDeclRefExportability.
Expand Down
Loading