forked from OSchip/llvm-project
Add a helper useful when mapping from a map element to its hash node.
llvm-svn: 42480
This commit is contained in:
parent
6c44b9f145
commit
b06396c588
|
@ -166,7 +166,18 @@ public:
|
||||||
MallocAllocator A;
|
MallocAllocator A;
|
||||||
return Create(KeyStart, KeyEnd, A);
|
return Create(KeyStart, KeyEnd, A);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// GetStringMapEntryFromValue - Given a value that is known to be embedded
|
||||||
|
/// into a StringMapEntry, return the StringMapEntry itself.
|
||||||
|
static StringMapEntry &GetStringMapEntryFromValue(ValueTy &V) {
|
||||||
|
return *reinterpret_cast<StringMapEntry*>(reinterpret_cast<char*>(&V) -
|
||||||
|
sizeof(StringMapEntryBase));
|
||||||
|
}
|
||||||
|
static const StringMapEntry &GetStringMapEntryFromValue(const ValueTy &V) {
|
||||||
|
return GetStringMapEntryFromValue(const_cast<ValueTy&>(V));
|
||||||
|
}
|
||||||
|
|
||||||
/// Destroy - Destroy this StringMapEntry, releasing memory back to the
|
/// Destroy - Destroy this StringMapEntry, releasing memory back to the
|
||||||
/// specified allocator.
|
/// specified allocator.
|
||||||
template<typename AllocatorTy>
|
template<typename AllocatorTy>
|
||||||
|
|
Loading…
Reference in New Issue