diff --git a/stdlib/public/Cxx/cxxshim/libcxxstdlibshim.h b/stdlib/public/Cxx/cxxshim/libcxxstdlibshim.h index 01f5d13fd26..04da6a003e5 100644 --- a/stdlib/public/Cxx/cxxshim/libcxxstdlibshim.h +++ b/stdlib/public/Cxx/cxxshim/libcxxstdlibshim.h @@ -2,7 +2,9 @@ #include #include #include +#if __has_include() #include +#endif /// Used for std::string conformance to Swift.Hashable typedef std::hash __swift_interopHashOfString; @@ -68,10 +70,16 @@ struct __SwiftFunctionWrapper { __swift_interop_closure closure; Result operator()(Args... args) const { +#if __has_include() return ((LoweredFunction *)ptrauth_auth_and_resign( closure.func, ptrauth_key_asia, PtrAuthTypeDiscriminator, ptrauth_key_function_pointer, 0))(std::forward(args)..., closure.context); +#else + // Android NDK 28 does not define the ptrauth macros. + return ((LoweredFunction *)closure.func)(std::forward(args)..., + closure.context); +#endif } // A memberwise constructor is synthesized by Swift.