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
642
642
const ModuleDecl *importedModule,
643
643
llvm::SmallSetVector<Identifier, 4 > &spiGroups) const ;
644
644
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?
646
646
bool isImportedAsSPI (const SpecializeAttr *attr,
647
647
const ValueDecl *targetDecl) const ;
648
648
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?
650
650
bool isImportedAsSPI (Identifier spiGroup, const ModuleDecl *fromModule) const ;
651
651
652
652
// / \sa getImportedModules
Original file line number Diff line number Diff line change @@ -2389,11 +2389,16 @@ void SourceFile::lookupImportedSPIGroups(
2389
2389
bool SourceFile::isImportedAsSPI (const ValueDecl *targetDecl) const {
2390
2390
auto targetModule = targetDecl->getModuleContext ();
2391
2391
llvm::SmallSetVector<Identifier, 4 > importedSPIGroups;
2392
+
2393
+ // Objective-C SPIs are always imported implicitly.
2394
+ if (targetDecl->hasClangNode ())
2395
+ return !targetDecl->getSPIGroups ().empty ();
2396
+
2392
2397
lookupImportedSPIGroups (targetModule, importedSPIGroups);
2393
- if (importedSPIGroups.empty ()) return false ;
2398
+ if (importedSPIGroups.empty ())
2399
+ return false ;
2394
2400
2395
2401
auto declSPIGroups = targetDecl->getSPIGroups ();
2396
-
2397
2402
for (auto declSPI : declSPIGroups)
2398
2403
if (importedSPIGroups.count (declSPI))
2399
2404
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