summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/Support/FoldingSet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/Support/FoldingSet.cpp')
-rw-r--r--contrib/llvm/lib/Support/FoldingSet.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/llvm/lib/Support/FoldingSet.cpp b/contrib/llvm/lib/Support/FoldingSet.cpp
index 52baf86..c9bca7f 100644
--- a/contrib/llvm/lib/Support/FoldingSet.cpp
+++ b/contrib/llvm/lib/Support/FoldingSet.cpp
@@ -54,8 +54,9 @@ void FoldingSetNodeID::AddPointer(const void *Ptr) {
// depend on the host. It doesn't matter, however, because hashing on
// pointer values is inherently unstable. Nothing should depend on the
// ordering of nodes in the folding set.
- Bits.append(reinterpret_cast<unsigned *>(&Ptr),
- reinterpret_cast<unsigned *>(&Ptr+1));
+ static_assert(sizeof(uintptr_t) <= sizeof(unsigned long long),
+ "unexpected pointer size");
+ AddInteger(reinterpret_cast<uintptr_t>(Ptr));
}
void FoldingSetNodeID::AddInteger(signed I) {
Bits.push_back(I);
@@ -80,8 +81,7 @@ void FoldingSetNodeID::AddInteger(long long I) {
}
void FoldingSetNodeID::AddInteger(unsigned long long I) {
AddInteger(unsigned(I));
- if ((uint64_t)(unsigned)I != I)
- Bits.push_back(unsigned(I >> 32));
+ AddInteger(unsigned(I >> 32));
}
void FoldingSetNodeID::AddString(StringRef String) {
@@ -127,8 +127,8 @@ void FoldingSetNodeID::AddString(StringRef String) {
// Pos will have overshot size by 4 - #bytes left over.
// No need to take endianness into account here - this is always executed.
switch (Pos - Size) {
- case 1: V = (V << 8) | (unsigned char)String[Size - 3]; // Fall thru.
- case 2: V = (V << 8) | (unsigned char)String[Size - 2]; // Fall thru.
+ case 1: V = (V << 8) | (unsigned char)String[Size - 3]; LLVM_FALLTHROUGH;
+ case 2: V = (V << 8) | (unsigned char)String[Size - 2]; LLVM_FALLTHROUGH;
case 3: V = (V << 8) | (unsigned char)String[Size - 1]; break;
default: return; // Nothing left.
}
OpenPOWER on IntegriCloud