aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-05-27 13:28:44 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-05-27 13:28:44 +0000
commit28b230723d5daf3c48c2e134f4b5626bd69392c8 (patch)
tree8dc6fdd08eaae4dd30223d39cf213c5848d7c816
parent4f85274e5447e3b1f71c2750304b5f1af11bc96b (diff)
Replace some custom hash combines with the standard stuff from DenseMapInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157531 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/BaseSubobject.h6
-rw-r--r--lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp13
-rw-r--r--tools/libclang/IndexingContext.h6
3 files changed, 10 insertions, 15 deletions
diff --git a/include/clang/AST/BaseSubobject.h b/include/clang/AST/BaseSubobject.h
index 6a036bb62c..da538e3566 100644
--- a/include/clang/AST/BaseSubobject.h
+++ b/include/clang/AST/BaseSubobject.h
@@ -66,9 +66,9 @@ template<> struct DenseMapInfo<clang::BaseSubobject> {
}
static unsigned getHashValue(const clang::BaseSubobject &Base) {
- return
- DenseMapInfo<const clang::CXXRecordDecl *>::getHashValue(Base.getBase()) ^
- DenseMapInfo<int64_t>::getHashValue(Base.getBaseOffset().getQuantity());
+ typedef std::pair<const clang::CXXRecordDecl *, clang::CharUnits> PairTy;
+ return DenseMapInfo<PairTy>::getHashValue(PairTy(Base.getBase(),
+ Base.getBaseOffset()));
}
static bool isEqual(const clang::BaseSubobject &LHS,
diff --git a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
index aab5552f66..4ade4827cb 100644
--- a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
@@ -473,17 +473,14 @@ template <> struct DenseMapInfo<ObjCSummaryKey> {
}
static unsigned getHashValue(const ObjCSummaryKey &V) {
- return (DenseMapInfo<IdentifierInfo*>::getHashValue(V.getIdentifier())
- & 0x88888888)
- | (DenseMapInfo<Selector>::getHashValue(V.getSelector())
- & 0x55555555);
+ typedef std::pair<IdentifierInfo*, Selector> PairTy;
+ return DenseMapInfo<PairTy>::getHashValue(PairTy(V.getIdentifier(),
+ V.getSelector()));
}
static bool isEqual(const ObjCSummaryKey& LHS, const ObjCSummaryKey& RHS) {
- return DenseMapInfo<IdentifierInfo*>::isEqual(LHS.getIdentifier(),
- RHS.getIdentifier()) &&
- DenseMapInfo<Selector>::isEqual(LHS.getSelector(),
- RHS.getSelector());
+ return LHS.getIdentifier() == RHS.getIdentifier() &&
+ LHS.getSelector() == RHS.getSelector();
}
};
diff --git a/tools/libclang/IndexingContext.h b/tools/libclang/IndexingContext.h
index 6271660c33..00e109644c 100644
--- a/tools/libclang/IndexingContext.h
+++ b/tools/libclang/IndexingContext.h
@@ -542,10 +542,8 @@ namespace llvm {
}
static unsigned getHashValue(clang::cxindex::RefFileOccurence S) {
- llvm::FoldingSetNodeID ID;
- ID.AddPointer(S.File);
- ID.AddPointer(S.Dcl);
- return ID.ComputeHash();
+ typedef std::pair<const clang::FileEntry *, const clang::Decl *> PairTy;
+ return DenseMapInfo<PairTy>::getHashValue(PairTy(S.File, S.Dcl));
}
static bool isEqual(clang::cxindex::RefFileOccurence LHS,