[PATCH] D68981: [clangd] Use our own relation kind.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 15 07:39:43 PDT 2019


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/index/MemIndex.cpp:95
     LookupRequest LookupReq;
-    auto It = Relations.find(std::make_pair(Subject, Req.Predicate));
+    auto It = Relations.find(std::make_pair(Subject, (uint8_t)Req.Predicate));
     if (It != Relations.end()) {
----------------
`static_cast<>`


================
Comment at: clang-tools-extra/clangd/index/MemIndex.h:75
+  static_assert(sizeof(RelationKind) == sizeof(uint8_t),
+                "use a mismatch type of RelationKind");
+  llvm::DenseMap<std::pair<SymbolID, uint8_t>, std::vector<SymbolID>> Relations;
----------------
"RelationKind should be of same size as a uint8_t"


================
Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:70
 
+// Provide DenseMapInfo for unsign chars.
+template <> struct DenseMapInfo<unsigned char> {
----------------
s/unsign/unsigned/


================
Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:74
+  static inline unsigned char getTombstoneKey() { return ~0 - 1; }
+  static unsigned getHashValue(const char &Val) { return Val * 37U; }
+
----------------
s/unsigned/unsigned char/
s/char/unsigned char/


================
Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:76
+
+  static bool isEqual(const char &LHS, const char &RHS) { return LHS == RHS; }
+};
----------------
s/char/unsigned char/


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68981/new/

https://reviews.llvm.org/D68981





More information about the cfe-commits mailing list