Skip to content

Commit 671cc80

Browse files
committed
[Sema] Refactor validateResilience to prepare for one more check
1 parent 21a2b78 commit 671cc80

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/Sema/ImportResolution.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -781,25 +781,24 @@ void UnboundImport::validateInterfaceWithPackageName(ModuleDecl *topLevelModule,
781781

782782
void UnboundImport::validateResilience(NullablePtr<ModuleDecl> topLevelModule,
783783
SourceFile &SF) {
784-
if (import.options.contains(ImportFlags::ImplementationOnly) ||
785-
import.accessLevel < AccessLevel::Public)
786-
return;
784+
ASTContext &ctx = SF.getASTContext();
787785

788786
// Per getTopLevelModule(), we'll only get nullptr here for non-Swift modules,
789787
// so these two really mean the same thing.
790788
if (!topLevelModule || topLevelModule.get()->isNonSwiftModule())
791789
return;
792790

793-
ASTContext &ctx = SF.getASTContext();
794-
795791
// If the module we're validating is the builtin one, then just return because
796792
// this module is essentially a header only import and does not concern
797793
// itself with resiliency. This can occur when one has passed
798794
// '-enable-builtin-module' and is explicitly importing the Builtin module in
799795
// their sources.
800-
if (topLevelModule.get() == ctx.TheBuiltinModule) {
796+
if (topLevelModule.get() == ctx.TheBuiltinModule)
797+
return;
798+
799+
if (import.options.contains(ImportFlags::ImplementationOnly) ||
800+
import.accessLevel < AccessLevel::Public)
801801
return;
802-
}
803802

804803
if (!SF.getParentModule()->isResilient() ||
805804
topLevelModule.get()->isResilient())

0 commit comments

Comments
 (0)