File tree Expand file tree Collapse file tree 5 files changed +25
-4
lines changed
Inputs/frameworks/SPIContainerImporter.framework Expand file tree Collapse file tree 5 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -642,11 +642,11 @@ class ModuleDecl
642642 const ModuleDecl *importedModule,
643643 llvm::SmallSetVector<Identifier, 4 > &spiGroups) const ;
644644
645- // Is \p attr accessible as an explictly imported SPI from this module?
645+ // Is \p attr accessible as an explicitly imported SPI from this module?
646646 bool isImportedAsSPI (const SpecializeAttr *attr,
647647 const ValueDecl *targetDecl) const ;
648648
649- // Is \p spiGroup accessible as an explictly imported SPI from this module?
649+ // Is \p spiGroup accessible as an explicitly imported SPI from this module?
650650 bool isImportedAsSPI (Identifier spiGroup, const ModuleDecl *fromModule) const ;
651651
652652 // / \sa getImportedModules
Original file line number Diff line number Diff line change @@ -2389,11 +2389,16 @@ void SourceFile::lookupImportedSPIGroups(
23892389bool SourceFile::isImportedAsSPI (const ValueDecl *targetDecl) const {
23902390 auto targetModule = targetDecl->getModuleContext ();
23912391 llvm::SmallSetVector<Identifier, 4 > importedSPIGroups;
2392+
2393+ // Objective-C SPIs are always imported implicitly.
2394+ if (targetDecl->hasClangNode ())
2395+ return !targetDecl->getSPIGroups ().empty ();
2396+
23922397 lookupImportedSPIGroups (targetModule, importedSPIGroups);
2393- if (importedSPIGroups.empty ()) return false ;
2398+ if (importedSPIGroups.empty ())
2399+ return false ;
23942400
23952401 auto declSPIGroups = targetDecl->getSPIGroups ();
2396-
23972402 for (auto declSPI : declSPIGroups)
23982403 if (importedSPIGroups.count (declSPI))
23992404 return true ;
Original file line number Diff line number Diff line change 1+ #import < SPIContainer/SPIContainer.h>
Original file line number Diff line number Diff line change 1+ framework module SPIContainerImporter {
2+ umbrella header "SPIContainerImporter.h"
3+ export *
4+ module * {
5+ export *
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ // REQUIRES: OS=macosx
2+ // RUN: %target-swift-frontend -typecheck %s -F %S/Inputs/frameworks -enable-clang-spi -verify
3+
4+ import SPIContainerImporter
5+
6+ @_spi ( a) public let a : SPIInterface1
7+
8+ public let c : SPIInterface1 // expected-error{{cannot use class 'SPIInterface1' here; it is an SPI imported from 'SPIContainer'}}
You can’t perform that action at this time.
0 commit comments