Remove isPod() from DenseMapInfo, splitting it out to its own

isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91421 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-12-15 07:26:43 +00:00
parent f8bc1e4b27
commit 4bbf4ee149
21 changed files with 118 additions and 82 deletions

View File

@@ -15,7 +15,7 @@
#define LLVM_ADT_DENSEMAPINFO_H
#include "llvm/Support/PointerLikeTypeTraits.h"
#include <utility>
#include "llvm/Support/type_traits.h"
namespace llvm {
@@ -25,7 +25,6 @@ struct DenseMapInfo {
//static inline T getTombstoneKey();
//static unsigned getHashValue(const T &Val);
//static bool isEqual(const T &LHS, const T &RHS);
//static bool isPod()
};
// Provide DenseMapInfo for all pointers.
@@ -46,7 +45,6 @@ struct DenseMapInfo<T*> {
(unsigned((uintptr_t)PtrVal) >> 9);
}
static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; }
static bool isPod() { return true; }
};
// Provide DenseMapInfo for chars.
@@ -54,7 +52,6 @@ template<> struct DenseMapInfo<char> {
static inline char getEmptyKey() { return ~0; }
static inline char getTombstoneKey() { return ~0 - 1; }
static unsigned getHashValue(const char& Val) { return Val * 37; }
static bool isPod() { return true; }
static bool isEqual(const char &LHS, const char &RHS) {
return LHS == RHS;
}
@@ -65,7 +62,6 @@ template<> struct DenseMapInfo<unsigned> {
static inline unsigned getEmptyKey() { return ~0; }
static inline unsigned getTombstoneKey() { return ~0U - 1; }
static unsigned getHashValue(const unsigned& Val) { return Val * 37; }
static bool isPod() { return true; }
static bool isEqual(const unsigned& LHS, const unsigned& RHS) {
return LHS == RHS;
}
@@ -78,7 +74,6 @@ template<> struct DenseMapInfo<unsigned long> {
static unsigned getHashValue(const unsigned long& Val) {
return (unsigned)(Val * 37UL);
}
static bool isPod() { return true; }
static bool isEqual(const unsigned long& LHS, const unsigned long& RHS) {
return LHS == RHS;
}
@@ -91,7 +86,6 @@ template<> struct DenseMapInfo<unsigned long long> {
static unsigned getHashValue(const unsigned long long& Val) {
return (unsigned)(Val * 37ULL);
}
static bool isPod() { return true; }
static bool isEqual(const unsigned long long& LHS,
const unsigned long long& RHS) {
return LHS == RHS;
@@ -127,7 +121,6 @@ struct DenseMapInfo<std::pair<T, U> > {
return (unsigned)key;
}
static bool isEqual(const Pair& LHS, const Pair& RHS) { return LHS == RHS; }
static bool isPod() { return FirstInfo::isPod() && SecondInfo::isPod(); }
};
} // end namespace llvm