@@ -1711,7 +1711,8 @@ static Type applyToFunctionType(
17111711}
17121712
17131713Type ClangImporter::Implementation::applyParamAttributes (
1714- const clang::ParmVarDecl *param, Type type) {
1714+ const clang::ParmVarDecl *param, Type type, bool &isUnsafeSendable,
1715+ bool &isUnsafeMainActor) {
17151716 if (!param->hasAttrs ())
17161717 return type;
17171718
@@ -1731,7 +1732,7 @@ Type ClangImporter::Implementation::applyParamAttributes(
17311732
17321733 // Map the main-actor attribute.
17331734 if (isMainActorAttr (SwiftContext, swiftAttr)) {
1734- if (Type mainActor = getMainActorType ()) {
1735+ if (Type mainActor = SwiftContext. getMainActorType ()) {
17351736 type = applyToFunctionType (type, [&](ASTExtInfo extInfo) {
17361737 return extInfo.withGlobalActor (mainActor);
17371738 });
@@ -1748,6 +1749,18 @@ Type ClangImporter::Implementation::applyParamAttributes(
17481749
17491750 continue ;
17501751 }
1752+
1753+ // Map @_unsafeSendable.
1754+ if (swiftAttr->getAttribute () == " @_unsafeSendable" ) {
1755+ isUnsafeSendable = true ;
1756+ continue ;
1757+ }
1758+
1759+ // Map @_unsafeMainActor.
1760+ if (swiftAttr->getAttribute () == " @_unsafeMainActor" ) {
1761+ isUnsafeMainActor = true ;
1762+ continue ;
1763+ }
17511764 }
17521765
17531766 return type;
@@ -1928,7 +1941,10 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19281941 }
19291942
19301943 // Apply attributes to the type.
1931- swiftParamTy = applyParamAttributes (param, swiftParamTy);
1944+ bool isUnsafeSendable = false ;
1945+ bool isUnsafeMainActor = false ;
1946+ swiftParamTy = applyParamAttributes (
1947+ param, swiftParamTy, isUnsafeSendable, isUnsafeMainActor);
19321948
19331949 // Figure out the name for this parameter.
19341950 Identifier bodyName = importFullName (param, CurrentVersion)
@@ -1949,6 +1965,8 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19491965 paramInfo->setSpecifier (ParamSpecifier::Default);
19501966 paramInfo->setInterfaceType (swiftParamTy);
19511967 recordImplicitUnwrapForDecl (paramInfo, isParamTypeImplicitlyUnwrapped);
1968+ recordUnsafeConcurrencyForDecl (
1969+ paramInfo, isUnsafeSendable, isUnsafeMainActor);
19521970 parameters.push_back (paramInfo);
19531971 ++index;
19541972 }
@@ -2426,7 +2444,10 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
24262444 }
24272445
24282446 // Apply Clang attributes to the parameter type.
2429- swiftParamTy = applyParamAttributes (param, swiftParamTy);
2447+ bool isUnsafeSendable = false ;
2448+ bool isUnsafeMainActor = false ;
2449+ swiftParamTy = applyParamAttributes (
2450+ param, swiftParamTy, isUnsafeSendable, isUnsafeMainActor);
24302451
24312452 // Figure out the name for this parameter.
24322453 Identifier bodyName = importFullName (param, CurrentVersion)
@@ -2450,6 +2471,8 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
24502471 paramInfo->setSpecifier (ParamSpecifier::Default);
24512472 paramInfo->setInterfaceType (swiftParamTy);
24522473 recordImplicitUnwrapForDecl (paramInfo, paramIsIUO);
2474+ recordUnsafeConcurrencyForDecl (
2475+ paramInfo, isUnsafeSendable, isUnsafeMainActor);
24532476
24542477 // Determine whether we have a default argument.
24552478 if (kind == SpecialMethodKind::Regular ||
0 commit comments