mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Allow the use of pointers to const within PointerUnion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68159 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b160f5d36d
commit
41222823db
@ -69,11 +69,13 @@ namespace llvm {
|
||||
PointerUnion() {}
|
||||
|
||||
PointerUnion(PT1 V) {
|
||||
Val.setPointer(PointerLikeTypeTraits<PT1>::getAsVoidPointer(V));
|
||||
Val.setPointer(
|
||||
const_cast<void *>(PointerLikeTypeTraits<PT1>::getAsVoidPointer(V)));
|
||||
Val.setInt(0);
|
||||
}
|
||||
PointerUnion(PT2 V) {
|
||||
Val.setPointer(PointerLikeTypeTraits<PT2>::getAsVoidPointer(V));
|
||||
Val.setPointer(
|
||||
const_cast<void *>(PointerLikeTypeTraits<PT2>::getAsVoidPointer(V)));
|
||||
Val.setInt(1);
|
||||
}
|
||||
|
||||
@ -109,12 +111,14 @@ namespace llvm {
|
||||
/// Assignment operators - Allow assigning into this union from either
|
||||
/// pointer type, setting the discriminator to remember what it came from.
|
||||
const PointerUnion &operator=(const PT1 &RHS) {
|
||||
Val.setPointer(PointerLikeTypeTraits<PT1>::getAsVoidPointer(RHS));
|
||||
Val.setPointer(
|
||||
const_cast<void *>(PointerLikeTypeTraits<PT1>::getAsVoidPointer(RHS)));
|
||||
Val.setInt(0);
|
||||
return *this;
|
||||
}
|
||||
const PointerUnion &operator=(const PT2 &RHS) {
|
||||
Val.setPointer(PointerLikeTypeTraits<PT2>::getAsVoidPointer(RHS));
|
||||
Val.setPointer(
|
||||
const_cast<void *>(PointerLikeTypeTraits<PT2>::getAsVoidPointer(RHS)));
|
||||
Val.setInt(1);
|
||||
return *this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user