summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJF Bastien <jfbastien@apple.com>2018-09-21 18:35:32 +0000
committerJF Bastien <jfbastien@apple.com>2018-09-21 18:35:32 +0000
commit8a59dbf7fd73f28792f605c059e5cea189e0c587 (patch)
tree2c5fd497cdbcf479e4584f0ddc06cd8a1db66cd2
parent62279730e2e2f22f24ee81896b8986c24e7fcd2e (diff)
downloadbcm5719-llvm-8a59dbf7fd73f28792f605c059e5cea189e0c587.tar.gz
bcm5719-llvm-8a59dbf7fd73f28792f605c059e5cea189e0c587.zip
[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
-rw-r--r--llvm/include/llvm/ADT/PointerSumType.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/include/llvm/ADT/PointerSumType.h b/llvm/include/llvm/ADT/PointerSumType.h
index f5b20533fe1..a19e45a4621 100644
--- a/llvm/include/llvm/ADT/PointerSumType.h
+++ b/llvm/include/llvm/ADT/PointerSumType.h
@@ -10,6 +10,7 @@
#ifndef LLVM_ADT_POINTERSUMTYPE_H
#define LLVM_ADT_POINTERSUMTYPE_H
+#include "llvm/ADT/bit.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
#include <cassert>
@@ -186,11 +187,9 @@ public:
}
uintptr_t getOpaqueValue() const {
- uintptr_t Value;
// Read the underlying storage of the union, regardless of the active
// member.
- memcpy(&Value, &Storage, sizeof(Value));
- return Value;
+ return bit_cast<uintptr_t>(Storage);
}
protected:
OpenPOWER on IntegriCloud