[clang-tools-extra] r320554 - [clangd] Overload hash_value for SymbolID, fix struct/class warning

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 13 00:34:48 PST 2017


Author: sammccall
Date: Wed Dec 13 00:34:48 2017
New Revision: 320554

URL: http://llvm.org/viewvc/llvm-project?rev=320554&view=rev
Log:
[clangd] Overload hash_value for SymbolID, fix struct/class warning

Modified:
    clang-tools-extra/trunk/clangd/index/Index.h

Modified: clang-tools-extra/trunk/clangd/index/Index.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Index.h?rev=320554&r1=320553&r2=320554&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/Index.h (original)
+++ clang-tools-extra/trunk/clangd/index/Index.h Wed Dec 13 00:34:48 2017
@@ -12,6 +12,7 @@
 
 #include "clang/Index/IndexSymbol.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/StringExtras.h"
 
 #include <array>
@@ -49,7 +50,9 @@ public:
   }
 
 private:
-  friend class llvm::DenseMapInfo<clang::clangd::SymbolID>;
+  friend llvm::hash_code hash_value(const SymbolID &ID) {
+    return hash_value(ArrayRef<uint8_t>(ID.HashValue));
+  }
 
   std::array<uint8_t, 20> HashValue;
 };
@@ -122,8 +125,7 @@ template <> struct DenseMapInfo<clang::c
     return TombstoneKey;
   }
   static unsigned getHashValue(const clang::clangd::SymbolID &Sym) {
-    return hash_value(
-        ArrayRef<uint8_t>(Sym.HashValue.data(), Sym.HashValue.size()));
+    return hash_value(Sym);
   }
   static bool isEqual(const clang::clangd::SymbolID &LHS,
                       const clang::clangd::SymbolID &RHS) {




More information about the cfe-commits mailing list