diff --git a/clang/include/clang/AST/BaseSubobject.h b/clang/include/clang/AST/BaseSubobject.h index 6a036bb62cf4..da538e3566a7 100644 --- a/clang/include/clang/AST/BaseSubobject.h +++ b/clang/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/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index aab5552f666d..4ade4827cb58 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/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/clang/tools/libclang/IndexingContext.h b/clang/tools/libclang/IndexingContext.h index 6271660c33ae..00e109644c23 100644 --- a/clang/tools/libclang/IndexingContext.h +++ b/clang/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,