28
28
#include " swift/ClangImporter/ClangModule.h"
29
29
#include " swift/Parse/Parser.h"
30
30
#include " swift/Subsystems.h"
31
- #include " swift/Strings.h"
32
31
#include " clang/Basic/Module.h"
33
32
#include " llvm/ADT/DenseMap.h"
34
33
#include " llvm/ADT/TinyPtrVector.h"
@@ -318,23 +317,6 @@ void ImportResolver::bindImport(UnboundImport &&I) {
318
317
ID.get ()->setModule (nullptr );
319
318
return ;
320
319
}
321
- // If the imported module is a clang module, add an implicit import statement
322
- // to request the SPIs from the module.
323
- if (M->isNonSwiftModule () && ID &&
324
- !ID.get ()->getAttrs ().hasAttribute <SPIAccessControlAttr>()) {
325
- ImportDecl *id = ID.get ();
326
- auto *newId = ImportDecl::create (id->getASTContext (), id->getDeclContext (),
327
- SourceLoc (), id->getImportKind (), SourceLoc (), id->getImportPath ());
328
- // Copy all the existing attribute from the actual import statement.
329
- llvm::for_each (id->getAttrs (),
330
- [&](DeclAttribute *attr) {newId->getAttrs ().add (attr);});
331
- // Add SPI attribute with the default group name.
332
- newId->getAttrs ().add (SPIAccessControlAttr::create (id->getASTContext (),
333
- SourceLoc (), SourceRange (),
334
- { ctx.getIdentifier (CLANG_MODULE_DEFUALT_SPI_GROUP_NAME) }));
335
- // So we'll resolve the new import.
336
- unboundImports.push_back (UnboundImport (newId));
337
- }
338
320
339
321
auto topLevelModule = I.getTopLevelModule (M, SF);
340
322
@@ -492,17 +474,13 @@ ModuleImplicitImportsRequest::evaluate(Evaluator &evaluator,
492
474
auto *clangImporter =
493
475
static_cast <ClangImporter *>(ctx.getClangModuleLoader ());
494
476
495
- SmallVector<Identifier, 4 > clangSpiGroups;
496
- clangSpiGroups.push_back (ctx.getIdentifier (CLANG_MODULE_DEFUALT_SPI_GROUP_NAME));
497
477
// Implicitly import the bridging header module if needed.
498
478
auto bridgingHeaderPath = importInfo.BridgingHeaderPath ;
499
479
if (!bridgingHeaderPath.empty () &&
500
480
!clangImporter->importBridgingHeader (bridgingHeaderPath, module )) {
501
481
auto *headerModule = clangImporter->getImportedHeaderModule ();
502
482
assert (headerModule && " Didn't load bridging header?" );
503
483
imports.emplace_back (ImportedModule (headerModule), ImportFlags::Exported);
504
- imports.back ().options |= ImportFlags::SPIAccessControl;
505
- imports.back ().spiGroups = ctx.AllocateCopy (clangSpiGroups);
506
484
}
507
485
508
486
// Implicitly import the underlying Clang half of this module if needed.
@@ -513,8 +491,6 @@ ModuleImplicitImportsRequest::evaluate(Evaluator &evaluator,
513
491
unloadedImports.emplace_back (UnloadedImportedModule (importPath.copyTo (ctx),
514
492
/* isScoped=*/ false ),
515
493
ImportFlags::Exported);
516
- unloadedImports.back ().options |= ImportFlags::SPIAccessControl;
517
- unloadedImports.back ().spiGroups = ctx.AllocateCopy (clangSpiGroups);
518
494
}
519
495
520
496
return { ctx.AllocateCopy (imports), ctx.AllocateCopy (unloadedImports) };
0 commit comments