mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Warn on all non-resilient uses of @_implementationOnly, even for clang targets
The warnings about `using '@_implementationOnly' without enabling library evolution for 'client' may lead to instability during execution` and `@_implementationOnly' is deprecated, use 'internal import' instead` were wrongly restricted to only Swift import targets. Make sure they are raised for clang module targets as well. rdar://135233043
This commit is contained in:
@@ -792,11 +792,7 @@ void UnboundImport::validateInterfaceWithPackageName(ModuleDecl *topLevelModule,
|
||||
|
||||
void UnboundImport::validateResilience(NullablePtr<ModuleDecl> topLevelModule,
|
||||
SourceFile &SF) {
|
||||
ASTContext &ctx = SF.getASTContext();
|
||||
|
||||
// Per getTopLevelModule(), we'll only get nullptr here for non-Swift modules,
|
||||
// so these two really mean the same thing.
|
||||
if (!topLevelModule || topLevelModule.get()->isNonSwiftModule())
|
||||
if (!topLevelModule)
|
||||
return;
|
||||
|
||||
// If the module we're validating is the builtin one, then just return because
|
||||
@@ -804,6 +800,7 @@ void UnboundImport::validateResilience(NullablePtr<ModuleDecl> topLevelModule,
|
||||
// itself with resiliency. This can occur when one has passed
|
||||
// '-enable-builtin-module' and is explicitly importing the Builtin module in
|
||||
// their sources.
|
||||
ASTContext &ctx = SF.getASTContext();
|
||||
if (topLevelModule.get() == ctx.TheBuiltinModule)
|
||||
return;
|
||||
|
||||
@@ -841,7 +838,8 @@ void UnboundImport::validateResilience(NullablePtr<ModuleDecl> topLevelModule,
|
||||
}
|
||||
|
||||
// Report public imports of non-resilient modules from a resilient module.
|
||||
if (import.options.contains(ImportFlags::ImplementationOnly) ||
|
||||
if (topLevelModule.get()->isNonSwiftModule() ||
|
||||
import.options.contains(ImportFlags::ImplementationOnly) ||
|
||||
import.accessLevel < AccessLevel::Public)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user