mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-01 08:28:19 +00:00
Allow the use of pointers to const within PointerUnion.
llvm-svn: 68159
This commit is contained in:
parent
2dd3b48ac1
commit
aaa9263fc6
@ -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