Skip to content

Commit 3401ebc

Browse files
committed
[Sema] Don't insert an @_spi on imports for clang SPIs
This attribute is no more needed as we now fast-track accepting all Objective-C SPIs at access control. rdar://85617355
1 parent b1eb438 commit 3401ebc

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

lib/Sema/ImportResolution.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "swift/ClangImporter/ClangModule.h"
2929
#include "swift/Parse/Parser.h"
3030
#include "swift/Subsystems.h"
31-
#include "swift/Strings.h"
3231
#include "clang/Basic/Module.h"
3332
#include "llvm/ADT/DenseMap.h"
3433
#include "llvm/ADT/TinyPtrVector.h"
@@ -318,23 +317,6 @@ void ImportResolver::bindImport(UnboundImport &&I) {
318317
ID.get()->setModule(nullptr);
319318
return;
320319
}
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-
}
338320

339321
auto topLevelModule = I.getTopLevelModule(M, SF);
340322

@@ -492,17 +474,13 @@ ModuleImplicitImportsRequest::evaluate(Evaluator &evaluator,
492474
auto *clangImporter =
493475
static_cast<ClangImporter *>(ctx.getClangModuleLoader());
494476

495-
SmallVector<Identifier, 4> clangSpiGroups;
496-
clangSpiGroups.push_back(ctx.getIdentifier(CLANG_MODULE_DEFUALT_SPI_GROUP_NAME));
497477
// Implicitly import the bridging header module if needed.
498478
auto bridgingHeaderPath = importInfo.BridgingHeaderPath;
499479
if (!bridgingHeaderPath.empty() &&
500480
!clangImporter->importBridgingHeader(bridgingHeaderPath, module)) {
501481
auto *headerModule = clangImporter->getImportedHeaderModule();
502482
assert(headerModule && "Didn't load bridging header?");
503483
imports.emplace_back(ImportedModule(headerModule), ImportFlags::Exported);
504-
imports.back().options |= ImportFlags::SPIAccessControl;
505-
imports.back().spiGroups = ctx.AllocateCopy(clangSpiGroups);
506484
}
507485

508486
// Implicitly import the underlying Clang half of this module if needed.
@@ -513,8 +491,6 @@ ModuleImplicitImportsRequest::evaluate(Evaluator &evaluator,
513491
unloadedImports.emplace_back(UnloadedImportedModule(importPath.copyTo(ctx),
514492
/*isScoped=*/false),
515493
ImportFlags::Exported);
516-
unloadedImports.back().options |= ImportFlags::SPIAccessControl;
517-
unloadedImports.back().spiGroups = ctx.AllocateCopy(clangSpiGroups);
518494
}
519495

520496
return { ctx.AllocateCopy(imports), ctx.AllocateCopy(unloadedImports) };

0 commit comments

Comments
 (0)