[cfe-commits] r157531 - in /cfe/trunk: include/clang/AST/BaseSubobject.h lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp tools/libclang/IndexingContext.h

Benjamin Kramer benny.kra at googlemail.com
Sun May 27 06:28:45 PDT 2012


Author: d0k
Date: Sun May 27 08:28:44 2012
New Revision: 157531

URL: http://llvm.org/viewvc/llvm-project?rev=157531&view=rev
Log:
Replace some custom hash combines with the standard stuff from DenseMapInfo.

Modified:
    cfe/trunk/include/clang/AST/BaseSubobject.h
    cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
    cfe/trunk/tools/libclang/IndexingContext.h

Modified: cfe/trunk/include/clang/AST/BaseSubobject.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BaseSubobject.h?rev=157531&r1=157530&r2=157531&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/BaseSubobject.h (original)
+++ cfe/trunk/include/clang/AST/BaseSubobject.h Sun May 27 08:28:44 2012
@@ -66,9 +66,9 @@
   }
 
   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, 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=157531&r1=157530&r2=157531&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Sun May 27 08:28:44 2012
@@ -473,17 +473,14 @@
   }
 
   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();
   }
 
 };

Modified: cfe/trunk/tools/libclang/IndexingContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.h?rev=157531&r1=157530&r2=157531&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.h (original)
+++ cfe/trunk/tools/libclang/IndexingContext.h Sun May 27 08:28:44 2012
@@ -542,10 +542,8 @@
     }
 
     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,





More information about the cfe-commits mailing list