Skip to content

Commit 956836c

Browse files
[Orc] Migrate ExecutorAddr::rawPtr to llvm::identity_cxx20 (NFC) (llvm#164364)
This patch updates ExecutorAddr::rawPtr to use llvm::identity_cxx20 to better align with C++20. Note that llvm::identity is a templated struct, while llvm::identity_cxx20 is a non-templated struct with a templated operator(). This patch makes rawPtr a non-templated type alias and adjusts use sites.
1 parent 03d26db commit 956836c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORADDRESS_H
1515

1616
#include "llvm/ADT/DenseMapInfo.h"
17-
#include "llvm/ADT/identity.h"
17+
#include "llvm/ADT/STLForwardCompat.h"
1818
#include "llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h"
1919
#include "llvm/Support/FormatVariadic.h"
2020
#include "llvm/Support/raw_ostream.h"
@@ -34,7 +34,7 @@ using ExecutorAddrDiff = uint64_t;
3434
class ExecutorAddr {
3535
public:
3636
/// A wrap/unwrap function that leaves pointers unmodified.
37-
template <typename T> using rawPtr = llvm::identity<T *>;
37+
using rawPtr = llvm::identity_cxx20;
3838

3939
#if __has_feature(ptrauth_calls)
4040
template <typename T> class PtrauthSignDefault {
@@ -63,10 +63,10 @@ class ExecutorAddr {
6363
#else
6464

6565
/// Default wrap function to use on this host.
66-
template <typename T> using defaultWrap = rawPtr<T>;
66+
template <typename T> using defaultWrap = rawPtr;
6767

6868
/// Default unwrap function to use on this host.
69-
template <typename T> using defaultUnwrap = rawPtr<T>;
69+
template <typename T> using defaultUnwrap = rawPtr;
7070

7171
#endif
7272

llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class ExecutorSymbolDef {
3333
JITSymbolFlags Flags = BaseFlags;
3434
if (std::is_function_v<T>)
3535
Flags |= JITSymbolFlags::Callable;
36-
return ExecutorSymbolDef(
37-
ExecutorAddr::fromPtr(UP, ExecutorAddr::rawPtr<T>()), Flags);
36+
return ExecutorSymbolDef(ExecutorAddr::fromPtr(UP, ExecutorAddr::rawPtr()),
37+
Flags);
3838
}
3939

4040
/// Cast this ExecutorSymbolDef to a pointer of the given type.

0 commit comments

Comments
 (0)