35
35
#include " swift/Runtime/EnvironmentVariables.h"
36
36
#include " swift/Runtime/HeapObject.h"
37
37
#include " swift/Runtime/Heap.h"
38
+ #include " swift/Runtime/STLCompatibility.h"
38
39
#include " swift/Threading/Mutex.h"
39
40
#include < atomic>
40
41
#include < new>
@@ -1059,8 +1060,6 @@ swift_task_create_commonImpl(size_t rawTaskCreateFlags,
1059
1060
// Initialize the parent context pointer to null.
1060
1061
initialContext->Parent = nullptr ;
1061
1062
1062
- #pragma clang diagnostic push
1063
- #pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
1064
1063
// Initialize the resumption funclet pointer (async return address) to
1065
1064
// the final funclet for completing the task.
1066
1065
@@ -1074,21 +1073,20 @@ swift_task_create_commonImpl(size_t rawTaskCreateFlags,
1074
1073
// The final funclet shouldn't release the task or the task function.
1075
1074
} else if (asyncLet) {
1076
1075
initialContext->ResumeParent =
1077
- reinterpret_cast <TaskContinuationFunction*>(&completeTask);
1076
+ std::bit_cast <TaskContinuationFunction *>(&completeTask);
1078
1077
1079
1078
// If we have a non-null closure context and the task function is not
1080
1079
// consumed by calling it, use a final funclet that releases both the
1081
1080
// task and the closure context.
1082
1081
} else if (closureContext && !taskCreateFlags.isTaskFunctionConsumed ()) {
1083
1082
initialContext->ResumeParent =
1084
- reinterpret_cast <TaskContinuationFunction*>(&completeTaskWithClosure);
1083
+ std::bit_cast <TaskContinuationFunction *>(&completeTaskWithClosure);
1085
1084
1086
1085
// Otherwise, just release the task.
1087
1086
} else {
1088
1087
initialContext->ResumeParent =
1089
- reinterpret_cast <TaskContinuationFunction*>(&completeTaskAndRelease);
1088
+ std::bit_cast <TaskContinuationFunction *>(&completeTaskAndRelease);
1090
1089
}
1091
- #pragma clang diagnostic pop
1092
1090
1093
1091
// Initialize the task-local allocator and our other private runtime
1094
1092
// state for the task.
0 commit comments