]> granicus.if.org Git - llvm/commitdiff
[clangd] Use our own relation kind.
authorHaojian Wu <hokein@google.com>
Thu, 17 Oct 2019 14:08:28 +0000 (14:08 +0000)
committerHaojian Wu <hokein@google.com>
Thu, 17 Oct 2019 14:08:28 +0000 (14:08 +0000)
Summary:
Move the RelationKind from Serialization.h to Relation.h. This patch doesn't
introduce any breaking changes.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68981

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375117 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/DenseMapInfo.h

index c4e8f2d4abc9b6ef745db1f9f7131018152dc05c..bd4c60c8f13ed459bf887d30f80c41f9ce15ba30 100644 (file)
@@ -67,6 +67,17 @@ template<> struct DenseMapInfo<char> {
   }
 };
 
+// Provide DenseMapInfo for unsigned chars.
+template <> struct DenseMapInfo<unsigned char> {
+  static inline unsigned char getEmptyKey() { return ~0; }
+  static inline unsigned char getTombstoneKey() { return ~0 - 1; }
+  static unsigned getHashValue(const unsigned char &Val) { return Val * 37U; }
+
+  static bool isEqual(const unsigned char &LHS, const unsigned char &RHS) {
+    return LHS == RHS;
+  }
+};
+
 // Provide DenseMapInfo for unsigned shorts.
 template <> struct DenseMapInfo<unsigned short> {
   static inline unsigned short getEmptyKey() { return 0xFFFF; }