Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions stdlib/public/Cxx/cxxshim/libcxxstdlibshim.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include <functional>
#include <string>
#include <type_traits>
#if __has_include(<ptrauth.h>)
#include <ptrauth.h>
#endif

/// Used for std::string conformance to Swift.Hashable
typedef std::hash<std::string> __swift_interopHashOfString;
Expand Down Expand Up @@ -68,10 +70,16 @@ struct __SwiftFunctionWrapper {
__swift_interop_closure closure;

Result operator()(Args... args) const {
#if __has_include(<ptrauth.h>)
return ((LoweredFunction *)ptrauth_auth_and_resign(
closure.func, ptrauth_key_asia, PtrAuthTypeDiscriminator,
ptrauth_key_function_pointer, 0))(std::forward<Args>(args)...,
closure.context);
#else
// Android NDK 28 does not define the ptrauth macros.
return ((LoweredFunction *)closure.func)(std::forward<Args>(args)...,
closure.context);
#endif
}

// A memberwise constructor is synthesized by Swift.
Expand Down