@@ -1711,7 +1711,8 @@ static Type applyToFunctionType(
17111711}
17121712
17131713Type ClangImporter::Implementation::applyParamAttributes (
1714- const clang::ParmVarDecl *param, Type type, bool &isUnsafeSendable) {
1714+ const clang::ParmVarDecl *param, Type type, bool &isUnsafeSendable,
1715+ bool &isUnsafeMainActor) {
17151716 if (!param->hasAttrs ())
17161717 return type;
17171718
@@ -1754,6 +1755,12 @@ Type ClangImporter::Implementation::applyParamAttributes(
17541755 isUnsafeSendable = true ;
17551756 continue ;
17561757 }
1758+
1759+ // Map @_unsafeMainActor.
1760+ if (swiftAttr->getAttribute () == " @_unsafeMainActor" ) {
1761+ isUnsafeMainActor = true ;
1762+ continue ;
1763+ }
17571764 }
17581765
17591766 return type;
@@ -1935,7 +1942,9 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19351942
19361943 // Apply attributes to the type.
19371944 bool isUnsafeSendable = false ;
1938- swiftParamTy = applyParamAttributes (param, swiftParamTy, isUnsafeSendable);
1945+ bool isUnsafeMainActor = false ;
1946+ swiftParamTy = applyParamAttributes (
1947+ param, swiftParamTy, isUnsafeSendable, isUnsafeMainActor);
19391948
19401949 // Figure out the name for this parameter.
19411950 Identifier bodyName = importFullName (param, CurrentVersion)
@@ -1956,7 +1965,8 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19561965 paramInfo->setSpecifier (ParamSpecifier::Default);
19571966 paramInfo->setInterfaceType (swiftParamTy);
19581967 recordImplicitUnwrapForDecl (paramInfo, isParamTypeImplicitlyUnwrapped);
1959- recordUnsafeSendableForDecl (paramInfo, isUnsafeSendable);
1968+ recordUnsafeConcurrencyForDecl (
1969+ paramInfo, isUnsafeSendable, isUnsafeMainActor);
19601970 parameters.push_back (paramInfo);
19611971 ++index;
19621972 }
@@ -2435,7 +2445,9 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
24352445
24362446 // Apply Clang attributes to the parameter type.
24372447 bool isUnsafeSendable = false ;
2438- swiftParamTy = applyParamAttributes (param, swiftParamTy, isUnsafeSendable);
2448+ bool isUnsafeMainActor = false ;
2449+ swiftParamTy = applyParamAttributes (
2450+ param, swiftParamTy, isUnsafeSendable, isUnsafeMainActor);
24392451
24402452 // Figure out the name for this parameter.
24412453 Identifier bodyName = importFullName (param, CurrentVersion)
@@ -2459,7 +2471,8 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
24592471 paramInfo->setSpecifier (ParamSpecifier::Default);
24602472 paramInfo->setInterfaceType (swiftParamTy);
24612473 recordImplicitUnwrapForDecl (paramInfo, paramIsIUO);
2462- recordUnsafeSendableForDecl (paramInfo, isUnsafeSendable);
2474+ recordUnsafeConcurrencyForDecl (
2475+ paramInfo, isUnsafeSendable, isUnsafeMainActor);
24632476
24642477 // Determine whether we have a default argument.
24652478 if (kind == SpecialMethodKind::Regular ||
0 commit comments