@@ -159,6 +159,10 @@ class SourceFile final : public FileUnit {
159
159
// / The highest access level of declarations referencing each import.
160
160
llvm::DenseMap<const ModuleDecl *, AccessLevel> ImportsUseAccessLevel;
161
161
162
+ // / Imports that should be printed in the module interface even though they
163
+ // / were not written in the source file.
164
+ llvm::SmallDenseSet<ImportedModule> ImplicitImportsForModuleInterface;
165
+
162
166
// / A unique identifier representing this file; used to mark private decls
163
167
// / within the file to keep them from conflicting with other files in the
164
168
// / same module.
@@ -510,12 +514,20 @@ class SourceFile final : public FileUnit {
510
514
511
515
SWIFT_DEBUG_DUMPER (dumpSeparatelyImportedOverlays());
512
516
513
- llvm::SmallDenseSet<ImportedModule> MissingImportedModules;
514
-
515
- void addMissingImportedModule (ImportedModule module ) const {
516
- const_cast <SourceFile *>(this )->MissingImportedModules .insert (module );
517
+ // / Record an import that should be printed in the module interface even
518
+ // / though it was not written in the source file. These imports are needed in
519
+ // / Swift 5 mode to preserve the integrity of swiftinterface files when code
520
+ // / publicly use declarations from modules that were \c `@_implementationOnly`
521
+ // / imported in other source files.
522
+ void addImplicitImportForModuleInterface (ImportedModule module ) {
523
+ ImplicitImportsForModuleInterface.insert (module );
517
524
}
518
525
526
+ // / Gather implicit imports that should printed in swiftinterfaces for
527
+ // / compatibility with code in some Swift 5 modules.
528
+ void getImplicitImportsForModuleInterface (
529
+ SmallVectorImpl<ImportedModule> &imports) const override ;
530
+
519
531
// / Record the source range info for a parsed \c #if clause.
520
532
void recordIfConfigClauseRangeInfo (const IfConfigClauseRangeInfo &range);
521
533
@@ -527,10 +539,10 @@ class SourceFile final : public FileUnit {
527
539
ArrayRef<IfConfigClauseRangeInfo>
528
540
getIfConfigClausesWithin (SourceRange outer) const ;
529
541
530
- void getMissingImportedModules (
531
- SmallVectorImpl<ImportedModule> &imports) const override ;
532
-
542
+ // / Record visible declarations for use in code completion and refactoring.
533
543
void cacheVisibleDecls (SmallVectorImpl<ValueDecl *> &&globals) const ;
544
+
545
+ // / Retrieve visible declarations for use in code completion and refactoring.
534
546
const SmallVectorImpl<ValueDecl *> &getCachedVisibleDecls () const ;
535
547
536
548
virtual void lookupValue (DeclName name, NLKind lookupKind,
0 commit comments