@@ -1711,7 +1711,8 @@ static Type applyToFunctionType(
1711
1711
}
1712
1712
1713
1713
Type ClangImporter::Implementation::applyParamAttributes (
1714
- const clang::ParmVarDecl *param, Type type, bool &isUnsafeSendable) {
1714
+ const clang::ParmVarDecl *param, Type type, bool &isUnsafeSendable,
1715
+ bool &isUnsafeMainActor) {
1715
1716
if (!param->hasAttrs ())
1716
1717
return type;
1717
1718
@@ -1754,6 +1755,12 @@ Type ClangImporter::Implementation::applyParamAttributes(
1754
1755
isUnsafeSendable = true ;
1755
1756
continue ;
1756
1757
}
1758
+
1759
+ // Map @_unsafeMainActor.
1760
+ if (swiftAttr->getAttribute () == " @_unsafeMainActor" ) {
1761
+ isUnsafeMainActor = true ;
1762
+ continue ;
1763
+ }
1757
1764
}
1758
1765
1759
1766
return type;
@@ -1935,7 +1942,9 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
1935
1942
1936
1943
// Apply attributes to the type.
1937
1944
bool isUnsafeSendable = false ;
1938
- swiftParamTy = applyParamAttributes (param, swiftParamTy, isUnsafeSendable);
1945
+ bool isUnsafeMainActor = false ;
1946
+ swiftParamTy = applyParamAttributes (
1947
+ param, swiftParamTy, isUnsafeSendable, isUnsafeMainActor);
1939
1948
1940
1949
// Figure out the name for this parameter.
1941
1950
Identifier bodyName = importFullName (param, CurrentVersion)
@@ -1956,7 +1965,8 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
1956
1965
paramInfo->setSpecifier (ParamSpecifier::Default);
1957
1966
paramInfo->setInterfaceType (swiftParamTy);
1958
1967
recordImplicitUnwrapForDecl (paramInfo, isParamTypeImplicitlyUnwrapped);
1959
- recordUnsafeSendableForDecl (paramInfo, isUnsafeSendable);
1968
+ recordUnsafeConcurrencyForDecl (
1969
+ paramInfo, isUnsafeSendable, isUnsafeMainActor);
1960
1970
parameters.push_back (paramInfo);
1961
1971
++index;
1962
1972
}
@@ -2435,7 +2445,9 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
2435
2445
2436
2446
// Apply Clang attributes to the parameter type.
2437
2447
bool isUnsafeSendable = false ;
2438
- swiftParamTy = applyParamAttributes (param, swiftParamTy, isUnsafeSendable);
2448
+ bool isUnsafeMainActor = false ;
2449
+ swiftParamTy = applyParamAttributes (
2450
+ param, swiftParamTy, isUnsafeSendable, isUnsafeMainActor);
2439
2451
2440
2452
// Figure out the name for this parameter.
2441
2453
Identifier bodyName = importFullName (param, CurrentVersion)
@@ -2459,7 +2471,8 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
2459
2471
paramInfo->setSpecifier (ParamSpecifier::Default);
2460
2472
paramInfo->setInterfaceType (swiftParamTy);
2461
2473
recordImplicitUnwrapForDecl (paramInfo, paramIsIUO);
2462
- recordUnsafeSendableForDecl (paramInfo, isUnsafeSendable);
2474
+ recordUnsafeConcurrencyForDecl (
2475
+ paramInfo, isUnsafeSendable, isUnsafeMainActor);
2463
2476
2464
2477
// Determine whether we have a default argument.
2465
2478
if (kind == SpecialMethodKind::Regular ||
0 commit comments