[PATCH] D63316: [clangd] Include the diagnostics's code when comparing diagnostics

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 14 00:29:22 PDT 2019


kadircet added a comment.

Could you also add a lit test for the case you mentioned in the github issue?

You can find pointers in clang-tools-extra/clangd/test/diagnostics.test and clang-tools-extra/clangd/test/fixits-codeaction.test



================
Comment at: clang-tools-extra/clangd/Protocol.h:654
   bool operator()(const Diagnostic &LHS, const Diagnostic &RHS) const {
-    return std::tie(LHS.range, LHS.message) < std::tie(RHS.range, RHS.message);
+    return std::tie(LHS.code, LHS.range, LHS.message) <
+           std::tie(RHS.code, RHS.range, RHS.message);
----------------
could you rather put `code` after range and message so that we somewhat preserve the ordering. I am not sure if it is used anywhere but looks like we are using an ordered container(std::map) to store these.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63316





More information about the cfe-commits mailing list