summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/FoldingSet.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2012-03-08 07:42:18 +0000
committerDaniel Dunbar <daniel@zuster.org>2012-03-08 07:42:18 +0000
commit544637937af1cee7b301212eb396c2ff8a4b906f (patch)
treeeaf822f2f7985c381d0aa87781885ec1916dd7c0 /llvm/lib/Support/FoldingSet.cpp
parent85fcc2daf569651b3e96954bd8d243d45fa88970 (diff)
downloadbcm5719-llvm-544637937af1cee7b301212eb396c2ff8a4b906f.tar.gz
bcm5719-llvm-544637937af1cee7b301212eb396c2ff8a4b906f.zip
[ADT] Change the trivial FoldingSetNodeID::Add* methods to be inline, reapplied
with a fix for the longstanding over-read of 32-bit pointer values. llvm-svn: 152300
Diffstat (limited to 'llvm/lib/Support/FoldingSet.cpp')
-rw-r--r--llvm/lib/Support/FoldingSet.cpp44
1 files changed, 1 insertions, 43 deletions
diff --git a/llvm/lib/Support/FoldingSet.cpp b/llvm/lib/Support/FoldingSet.cpp
index e029970b586..d182d480354 100644
--- a/llvm/lib/Support/FoldingSet.cpp
+++ b/llvm/lib/Support/FoldingSet.cpp
@@ -41,43 +41,6 @@ bool FoldingSetNodeIDRef::operator==(FoldingSetNodeIDRef RHS) const {
//===----------------------------------------------------------------------===//
// FoldingSetNodeID Implementation
-/// Add* - Add various data types to Bit data.
-///
-void FoldingSetNodeID::AddPointer(const void *Ptr) {
- // Note: this adds pointers to the hash using sizes and endianness that
- // depend on the host. It doesn't matter however, because hashing on
- // pointer values in 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));
-}
-void FoldingSetNodeID::AddInteger(signed I) {
- Bits.push_back(I);
-}
-void FoldingSetNodeID::AddInteger(unsigned I) {
- Bits.push_back(I);
-}
-void FoldingSetNodeID::AddInteger(long I) {
- AddInteger((unsigned long)I);
-}
-void FoldingSetNodeID::AddInteger(unsigned long I) {
- if (sizeof(long) == sizeof(int))
- AddInteger(unsigned(I));
- else if (sizeof(long) == sizeof(long long)) {
- AddInteger((unsigned long long)I);
- } else {
- llvm_unreachable("unexpected sizeof(long)");
- }
-}
-void FoldingSetNodeID::AddInteger(long long I) {
- AddInteger((unsigned 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));
-}
-
void FoldingSetNodeID::AddString(StringRef String) {
unsigned Size = String.size();
Bits.push_back(Size);
@@ -129,12 +92,7 @@ void FoldingSetNodeID::AddString(StringRef String) {
Bits.push_back(V);
}
-// AddNodeID - Adds the Bit data of another ID to *this.
-void FoldingSetNodeID::AddNodeID(const FoldingSetNodeID &ID) {
- Bits.append(ID.Bits.begin(), ID.Bits.end());
-}
-
-/// ComputeHash - Compute a strong hash value for this FoldingSetNodeID, used to
+/// ComputeHash - Compute a strong hash value for this FoldingSetNodeID, used to
/// lookup the node in the FoldingSetImpl.
unsigned FoldingSetNodeID::ComputeHash() const {
return FoldingSetNodeIDRef(Bits.data(), Bits.size()).ComputeHash();
OpenPOWER on IntegriCloud