mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +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:
@@ -216,6 +216,14 @@ public:
|
|||||||
static const StringMapEntry &GetStringMapEntryFromValue(const ValueTy &V) {
|
static const StringMapEntry &GetStringMapEntryFromValue(const ValueTy &V) {
|
||||||
return GetStringMapEntryFromValue(const_cast<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
|
/// Destroy - Destroy this StringMapEntry, releasing memory back to the
|
||||||
/// specified allocator.
|
/// specified allocator.
|
||||||
|
Reference in New Issue
Block a user