forked from OSchip/llvm-project
[ORC-RT] Make ExecutorAddr hashable.
This will be used in an upcoming macho_platform patch.
This commit is contained in:
parent
c840047c38
commit
ea0ce326fd
|
@ -212,4 +212,15 @@ using SPSExecutorAddrRangeSequence = SPSSequence<SPSExecutorAddrRange>;
|
|||
|
||||
} // End namespace __orc_rt
|
||||
|
||||
namespace std {
|
||||
|
||||
// Make ExecutorAddr hashable.
|
||||
template <> struct hash<__orc_rt::ExecutorAddr> {
|
||||
size_t operator()(const __orc_rt::ExecutorAddr &A) const {
|
||||
return hash<uint64_t>()(A.getValue());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // ORC_RT_EXECUTOR_ADDRESS_H
|
||||
|
|
|
@ -75,3 +75,10 @@ TEST(ExecutorAddrTest, AddrRanges) {
|
|||
EXPECT_TRUE(R1.overlaps(R3));
|
||||
EXPECT_TRUE(R1.overlaps(R4));
|
||||
}
|
||||
|
||||
TEST(ExecutorAddrTest, Hashable) {
|
||||
uint64_t RawAddr = 0x1234567890ABCDEF;
|
||||
ExecutorAddr Addr(RawAddr);
|
||||
|
||||
EXPECT_EQ(std::hash<uint64_t>()(RawAddr), std::hash<ExecutorAddr>()(Addr));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue