mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
[NFC] use bit_cast in PointerSumType
The code was already using union and memcpy to do this. Remove the memcpy. We can't just change the union because a reference to its member is returned. llvm-svn: 342759
This commit is contained in:
parent
a80f68a4d0
commit
5e7bfbaecc
@ -10,6 +10,7 @@
|
|||||||
#ifndef LLVM_ADT_POINTERSUMTYPE_H
|
#ifndef LLVM_ADT_POINTERSUMTYPE_H
|
||||||
#define LLVM_ADT_POINTERSUMTYPE_H
|
#define LLVM_ADT_POINTERSUMTYPE_H
|
||||||
|
|
||||||
|
#include "llvm/ADT/bit.h"
|
||||||
#include "llvm/ADT/DenseMapInfo.h"
|
#include "llvm/ADT/DenseMapInfo.h"
|
||||||
#include "llvm/Support/PointerLikeTypeTraits.h"
|
#include "llvm/Support/PointerLikeTypeTraits.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -186,11 +187,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t getOpaqueValue() const {
|
uintptr_t getOpaqueValue() const {
|
||||||
uintptr_t Value;
|
|
||||||
// Read the underlying storage of the union, regardless of the active
|
// Read the underlying storage of the union, regardless of the active
|
||||||
// member.
|
// member.
|
||||||
memcpy(&Value, &Storage, sizeof(Value));
|
return bit_cast<uintptr_t>(Storage);
|
||||||
return Value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user