From 6ca9f42189b668940e87f76eec5d92d00fe331f8 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 1 Sep 2022 16:07:38 -0700 Subject: [PATCH] [ORC][ORC-RT] Consistently use pointed-to type as template arg to wrap/unwrap. Saves wrap/unwrap implementers from having to use std::remove_pointer_t to get at the pointed-to type. --- compiler-rt/lib/orc/executor_address.h | 8 ++++---- llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler-rt/lib/orc/executor_address.h b/compiler-rt/lib/orc/executor_address.h index e541d13..fcdbe5e 100644 --- a/compiler-rt/lib/orc/executor_address.h +++ b/compiler-rt/lib/orc/executor_address.h @@ -40,7 +40,7 @@ private: class ExecutorAddr { public: /// A wrap/unwrap function that leaves pointers unmodified. - template using rawPtr = __orc_rt::identity; + template using rawPtr = __orc_rt::identity; /// Default wrap function to use on this host. template using defaultWrap = rawPtr; @@ -82,14 +82,14 @@ public: explicit ExecutorAddr(uint64_t Addr) : Addr(Addr) {} /// Create an ExecutorAddr from the given pointer. - template > + template > static ExecutorAddr fromPtr(T *Ptr, UnwrapFn &&Unwrap = UnwrapFn()) { return ExecutorAddr( static_cast(reinterpret_cast(Unwrap(Ptr)))); } /// Cast this ExecutorAddr to a pointer of the given type. - template > + template >> std::enable_if_t::value, T> toPtr(WrapFn &&Wrap = WrapFn()) const { uintptr_t IntPtr = static_cast(Addr); @@ -98,7 +98,7 @@ public: } /// Cast this ExecutorAddr to a pointer of the given function type. - template > + template > std::enable_if_t::value, T *> toPtr(WrapFn &&Wrap = WrapFn()) const { uintptr_t IntPtr = static_cast(Addr); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h index cb0c0a4..f6673b1 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h @@ -31,7 +31,7 @@ using ExecutorAddrDiff = uint64_t; class ExecutorAddr { public: /// A wrap/unwrap function that leaves pointers unmodified. - template using rawPtr = llvm::identity; + template using rawPtr = llvm::identity; /// Default wrap function to use on this host. template using defaultWrap = rawPtr; @@ -76,7 +76,7 @@ public: /// Create an ExecutorAddr from the given pointer. /// Warning: This should only be used when JITing in-process. - template > + template > static ExecutorAddr fromPtr(T *Ptr, UnwrapFn &&Unwrap = UnwrapFn()) { return ExecutorAddr( static_cast(reinterpret_cast(Unwrap(Ptr)))); @@ -84,7 +84,7 @@ public: /// Cast this ExecutorAddr to a pointer of the given type. /// Warning: This should only be used when JITing in-process. - template > + template >> std::enable_if_t::value, T> toPtr(WrapFn &&Wrap = WrapFn()) const { uintptr_t IntPtr = static_cast(Addr); @@ -94,7 +94,7 @@ public: /// Cast this ExecutorAddr to a pointer of the given function type. /// Warning: This should only be used when JITing in-process. - template > + template > std::enable_if_t::value, T *> toPtr(WrapFn &&Wrap = WrapFn()) const { uintptr_t IntPtr = static_cast(Addr); -- 2.7.4