@@ -653,7 +653,8 @@ class ModuleDecl : public DeclContext, public TypeDecl {
653
653
Default = 1 << 1 ,
654
654
// / Include imports declared with `@_implementationOnly`.
655
655
ImplementationOnly = 1 << 2 ,
656
- // / Include imports of SPIs declared with `@_spi`
656
+ // / Include imports of SPIs declared with `@_spi`. Non-SPI imports are
657
+ // / included whether or not this flag is specified.
657
658
SPIAccessControl = 1 << 3 ,
658
659
// / Include imports shadowed by a cross-import overlay. Unshadowed imports
659
660
// / are included whether or not this flag is specified.
@@ -664,8 +665,33 @@ class ModuleDecl : public DeclContext, public TypeDecl {
664
665
665
666
// / Looks up which modules are imported by this module.
666
667
// /
667
- // / \p filter controls whether public, private, or any imports are included
668
- // / in this list.
668
+ // / \p filter controls which imports are included in the list.
669
+ // /
670
+ // / There are three axes for categorizing imports:
671
+ // / 1. Privacy: Exported/Private/ImplementationOnly (mutually exclusive).
672
+ // / 2. SPI/non-SPI: An import of any privacy level may be @_spi("SPIName").
673
+ // / 3. Shadowed/Non-shadowed: An import of any privacy level may be shadowed
674
+ // / by a cross-import overlay.
675
+ // /
676
+ // / It is also possible for SPI imports to be shadowed by a cross-import
677
+ // / overlay.
678
+ // /
679
+ // / If \p filter contains multiple privacy levels, modules at all the privacy
680
+ // / levels are included.
681
+ // /
682
+ // / If \p filter contains \c ImportFilterKind::SPIAccessControl, then both
683
+ // / SPI and non-SPI imports are included. Otherwise, only non-SPI imports are
684
+ // / included.
685
+ // /
686
+ // / If \p filter contains \c ImportFilterKind::ShadowedByCrossImportOverlay,
687
+ // / both shadowed and non-shadowed imports are included. Otherwise, only
688
+ // / non-shadowed imports are included.
689
+ // /
690
+ // / Clang modules have some additional complexities; see the implementation of
691
+ // / \c ClangModuleUnit::getImportedModules for details.
692
+ // /
693
+ // / \pre \p filter must contain at least one privacy level, i.e. one of
694
+ // / \c Exported or \c Private or \c ImplementationOnly.
669
695
void getImportedModules (SmallVectorImpl<ImportedModule> &imports,
670
696
ImportFilter filter = ImportFilterKind::Exported) const ;
671
697
0 commit comments