mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-06 09:44:39 +00:00
Add a method to get a StringMapEntry from a pointer to the string
data it contains (similar to GetStringMapEntryFromValue). Patch by Greg Clayton! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99371 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1aec4d7596
commit
8ee0769612
@ -216,6 +216,14 @@ public:
|
||||
static const StringMapEntry &GetStringMapEntryFromValue(const ValueTy &V) {
|
||||
return GetStringMapEntryFromValue(const_cast<ValueTy&>(V));
|
||||
}
|
||||
|
||||
/// GetStringMapEntryFromKeyData - Given key data that is known to be embedded
|
||||
/// into a StringMapEntry, return the StringMapEntry itself.
|
||||
static StringMapEntry &GetStringMapEntryFromKeyData(const char *KeyData) {
|
||||
char *Ptr = const_cast<char*>(KeyData) - sizeof(StringMapEntry<ValueTy>);
|
||||
return *reinterpret_cast<StringMapEntry*>(Ptr);
|
||||
}
|
||||
|
||||
|
||||
/// Destroy - Destroy this StringMapEntry, releasing memory back to the
|
||||
/// specified allocator.
|
||||
|
Loading…
x
Reference in New Issue
Block a user