mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-22 10:33:23 +00:00
Make this compute the correct offset, handling alignment of the element
pointer correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42918 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
48ff282dd4
commit
b89f67e3e6
@ -171,8 +171,9 @@ public:
|
|||||||
/// GetStringMapEntryFromValue - Given a value that is known to be embedded
|
/// GetStringMapEntryFromValue - Given a value that is known to be embedded
|
||||||
/// into a StringMapEntry, return the StringMapEntry itself.
|
/// into a StringMapEntry, return the StringMapEntry itself.
|
||||||
static StringMapEntry &GetStringMapEntryFromValue(ValueTy &V) {
|
static StringMapEntry &GetStringMapEntryFromValue(ValueTy &V) {
|
||||||
return *reinterpret_cast<StringMapEntry*>(reinterpret_cast<char*>(&V) -
|
StringMapEntry *EPtr = 0;
|
||||||
sizeof(StringMapEntryBase));
|
char *Ptr = reinterpret_cast<char*>(&V) - (intptr_t)&EPtr->Val;
|
||||||
|
return *reinterpret_cast<StringMapEntry*>(Ptr);
|
||||||
}
|
}
|
||||||
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));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user