@@ -4767,14 +4767,15 @@ static Type applyUnsafeConcurrencyToParameterType(
47674767
47684768// / Determine whether the given name is that of a DispatchQueue operation that
47694769// / takes a closure to be executed on the queue.
4770- bool swift::isDispatchQueueOperationName (StringRef name) {
4771- return llvm::StringSwitch<bool >(name)
4772- .Case (" sync" , true )
4773- .Case (" async" , true )
4774- .Case (" asyncAndWait" , true )
4775- .Case (" asyncAfter" , true )
4776- .Case (" concurrentPerform" , true )
4777- .Default (false );
4770+ Optional<DispatchQueueOperation>
4771+ swift::isDispatchQueueOperationName (StringRef name) {
4772+ return llvm::StringSwitch<Optional<DispatchQueueOperation>>(name)
4773+ .Case (" sync" , DispatchQueueOperation::Normal)
4774+ .Case (" async" , DispatchQueueOperation::Sendable)
4775+ .Case (" asyncAndWait" , DispatchQueueOperation::Normal)
4776+ .Case (" asyncAfter" , DispatchQueueOperation::Sendable)
4777+ .Case (" concurrentPerform" , DispatchQueueOperation::Sendable)
4778+ .Default (None);
47784779}
47794780
47804781// / Determine whether this function is implicitly known to have its
@@ -4792,7 +4793,17 @@ static bool hasKnownUnsafeSendableFunctionParams(AbstractFunctionDecl *func) {
47924793 auto nominalName = nominal->getName ().str ();
47934794 if (nominalName == " DispatchQueue" ) {
47944795 auto name = func->getBaseName ().userFacingName ();
4795- return isDispatchQueueOperationName (name);
4796+ auto operation = isDispatchQueueOperationName (name);
4797+ if (!operation)
4798+ return false ;
4799+
4800+ switch (*operation) {
4801+ case DispatchQueueOperation::Normal:
4802+ return false ;
4803+
4804+ case DispatchQueueOperation::Sendable:
4805+ return true ;
4806+ }
47964807 }
47974808
47984809 return false ;
0 commit comments