Merge remote-tracking branch 'origin/main' into rebranch

This commit is contained in:
swift-ci
2025-05-09 11:19:56 -07:00
5 changed files with 138 additions and 4 deletions

View File

@@ -41,9 +41,17 @@ Destination function_cast(Source source) {
static_assert(std::is_trivially_copyable_v<Destination>,
"The destination type must be trivially constructible");
#if __has_feature(ptrauth_calls)
// Use reinterpret_cast here so we perform any necessary auth-and-sign.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
return reinterpret_cast<Destination>(source);
#pragma clang diagnostic pop
#else
Destination destination;
memcpy(&destination, &source, sizeof(source));
return destination;
#endif
}
}