Replace some custom hash combines with the standard stuff from DenseMapInfo.

llvm-svn: 157531
This commit is contained in:
Benjamin Kramer 2012-05-27 13:28:44 +00:00
parent 42e5ac409c
commit 69b5a60d96
3 changed files with 10 additions and 15 deletions

View File

@ -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,

View File

@ -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();
}
};

View File

@ -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,