Skip to content

Commit 962c114

Browse files
committed
Remove Clang Importer support for @_unsafeSendable/@_unsafeMainActor.
1 parent a77f05f commit 962c114

File tree

2 files changed

+4
-40
lines changed

2 files changed

+4
-40
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,8 +1707,7 @@ static Type applyToFunctionType(
17071707
}
17081708

17091709
Type ClangImporter::Implementation::applyParamAttributes(
1710-
const clang::ParmVarDecl *param, Type type, bool &isUnsafeSendable,
1711-
bool &isUnsafeMainActor) {
1710+
const clang::ParmVarDecl *param, Type type) {
17121711
if (!param->hasAttrs())
17131712
return type;
17141713

@@ -1745,18 +1744,6 @@ Type ClangImporter::Implementation::applyParamAttributes(
17451744

17461745
continue;
17471746
}
1748-
1749-
// Map @_unsafeSendable.
1750-
if (swiftAttr->getAttribute() == "@_unsafeSendable") {
1751-
isUnsafeSendable = true;
1752-
continue;
1753-
}
1754-
1755-
// Map @_unsafeMainActor.
1756-
if (swiftAttr->getAttribute() == "@_unsafeMainActor") {
1757-
isUnsafeMainActor = true;
1758-
continue;
1759-
}
17601747
}
17611748

17621749
return type;
@@ -1953,10 +1940,8 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19531940
}
19541941

19551942
// Apply attributes to the type.
1956-
bool isUnsafeSendable = false;
1957-
bool isUnsafeMainActor = false;
19581943
swiftParamTy = applyParamAttributes(
1959-
param, swiftParamTy, isUnsafeSendable, isUnsafeMainActor);
1944+
param, swiftParamTy);
19601945

19611946
// Figure out the name for this parameter.
19621947
Identifier bodyName = importFullName(param, CurrentVersion)
@@ -1978,8 +1963,6 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19781963
: ParamSpecifier::Default);
19791964
paramInfo->setInterfaceType(swiftParamTy);
19801965
recordImplicitUnwrapForDecl(paramInfo, isParamTypeImplicitlyUnwrapped);
1981-
recordUnsafeConcurrencyForDecl(
1982-
paramInfo, isUnsafeSendable, isUnsafeMainActor);
19831966
parameters.push_back(paramInfo);
19841967
++index;
19851968
}
@@ -2544,10 +2527,7 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
25442527
}
25452528

25462529
// Apply Clang attributes to the parameter type.
2547-
bool isUnsafeSendable = false;
2548-
bool isUnsafeMainActor = false;
2549-
swiftParamTy = applyParamAttributes(
2550-
param, swiftParamTy, isUnsafeSendable, isUnsafeMainActor);
2530+
swiftParamTy = applyParamAttributes(param, swiftParamTy);
25512531

25522532
// Figure out the name for this parameter.
25532533
Identifier bodyName = importFullName(param, CurrentVersion)
@@ -2571,8 +2551,6 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
25712551
paramInfo->setSpecifier(ParamSpecifier::Default);
25722552
paramInfo->setInterfaceType(swiftParamTy);
25732553
recordImplicitUnwrapForDecl(paramInfo, paramIsIUO);
2574-
recordUnsafeConcurrencyForDecl(
2575-
paramInfo, isUnsafeSendable, isUnsafeMainActor);
25762554

25772555
// Determine whether we have a default argument.
25782556
if (kind == SpecialMethodKind::Regular ||

lib/ClangImporter/ImporterImpl.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -685,19 +685,6 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
685685
decl->setImplicitlyUnwrappedOptional(true);
686686
}
687687

688-
void recordUnsafeConcurrencyForDecl(
689-
ValueDecl *decl, bool isUnsafeSendable, bool isUnsafeMainActor) {
690-
if (isUnsafeSendable) {
691-
decl->getAttrs().add(
692-
new (SwiftContext) UnsafeSendableAttr(/*implicit=*/true));
693-
}
694-
695-
if (isUnsafeMainActor) {
696-
decl->getAttrs().add(
697-
new (SwiftContext) UnsafeMainActorAttr(/*implicit=*/true));
698-
}
699-
}
700-
701688
/// Retrieve the Clang AST context.
702689
clang::ASTContext &getClangASTContext() const {
703690
return Instance->getASTContext();
@@ -848,8 +835,7 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
848835
void importAttributes(const clang::NamedDecl *ClangDecl, Decl *MappedDecl,
849836
const clang::ObjCContainerDecl *NewContext = nullptr);
850837

851-
Type applyParamAttributes(const clang::ParmVarDecl *param, Type type,
852-
bool &isUnsafeSendable, bool &isUnsafeMainActor);
838+
Type applyParamAttributes(const clang::ParmVarDecl *param, Type type);
853839

854840
/// If we already imported a given decl, return the corresponding Swift decl.
855841
/// Otherwise, return nullptr.

0 commit comments

Comments
 (0)