class ExecutorAddr {
public:
/// A wrap/unwrap function that leaves pointers unmodified.
- template <typename T> using rawPtr = __orc_rt::identity<T>;
+ template <typename T> using rawPtr = __orc_rt::identity<T *>;
/// Default wrap function to use on this host.
template <typename T> using defaultWrap = rawPtr<T>;
explicit ExecutorAddr(uint64_t Addr) : Addr(Addr) {}
/// Create an ExecutorAddr from the given pointer.
- template <typename T, typename UnwrapFn = defaultUnwrap<T *>>
+ template <typename T, typename UnwrapFn = defaultUnwrap<T>>
static ExecutorAddr fromPtr(T *Ptr, UnwrapFn &&Unwrap = UnwrapFn()) {
return ExecutorAddr(
static_cast<uint64_t>(reinterpret_cast<uintptr_t>(Unwrap(Ptr))));
}
/// Cast this ExecutorAddr to a pointer of the given type.
- template <typename T, typename WrapFn = defaultWrap<T>>
+ template <typename T, typename WrapFn = defaultWrap<std::remove_pointer_t<T>>>
std::enable_if_t<std::is_pointer<T>::value, T>
toPtr(WrapFn &&Wrap = WrapFn()) const {
uintptr_t IntPtr = static_cast<uintptr_t>(Addr);
}
/// Cast this ExecutorAddr to a pointer of the given function type.
- template <typename T, typename WrapFn = defaultWrap<T *>>
+ template <typename T, typename WrapFn = defaultWrap<T>>
std::enable_if_t<std::is_function<T>::value, T *>
toPtr(WrapFn &&Wrap = WrapFn()) const {
uintptr_t IntPtr = static_cast<uintptr_t>(Addr);
class ExecutorAddr {
public:
/// A wrap/unwrap function that leaves pointers unmodified.
- template <typename T> using rawPtr = llvm::identity<T>;
+ template <typename T> using rawPtr = llvm::identity<T *>;
/// Default wrap function to use on this host.
template <typename T> using defaultWrap = rawPtr<T>;
/// Create an ExecutorAddr from the given pointer.
/// Warning: This should only be used when JITing in-process.
- template <typename T, typename UnwrapFn = defaultUnwrap<T *>>
+ template <typename T, typename UnwrapFn = defaultUnwrap<T>>
static ExecutorAddr fromPtr(T *Ptr, UnwrapFn &&Unwrap = UnwrapFn()) {
return ExecutorAddr(
static_cast<uint64_t>(reinterpret_cast<uintptr_t>(Unwrap(Ptr))));
/// Cast this ExecutorAddr to a pointer of the given type.
/// Warning: This should only be used when JITing in-process.
- template <typename T, typename WrapFn = defaultWrap<T>>
+ template <typename T, typename WrapFn = defaultWrap<std::remove_pointer_t<T>>>
std::enable_if_t<std::is_pointer<T>::value, T>
toPtr(WrapFn &&Wrap = WrapFn()) const {
uintptr_t IntPtr = static_cast<uintptr_t>(Addr);
/// Cast this ExecutorAddr to a pointer of the given function type.
/// Warning: This should only be used when JITing in-process.
- template <typename T, typename WrapFn = defaultWrap<T *>>
+ template <typename T, typename WrapFn = defaultWrap<T>>
std::enable_if_t<std::is_function<T>::value, T *>
toPtr(WrapFn &&Wrap = WrapFn()) const {
uintptr_t IntPtr = static_cast<uintptr_t>(Addr);