[PATCH] D50555: [clangd] Introduce scoring mechanism for SignatureInformations.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 10 05:24:23 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/CodeComplete.cpp:715
                                  unsigned NumCandidates) override {
+    TopN<ScoredSignature, ScoredSignatureGreater> Top(
+        std::numeric_limits<size_t>::max());
----------------
Maybe use `vector<ScoredSignature>`, followed by `std::sort` at the end?

Or is there any functionality that we can reuse from the priority queue?


================
Comment at: clangd/Quality.h:170
+  bool ContainsActiveParameter = false;
+  CodeCompleteConsumer::OverloadCandidate::CandidateKind Kind;
+
----------------
Maybe set some default value to avoid UB if someone forgets to set it?


================
Comment at: clangd/Quality.h:172
+
+  float evaluate() const;
+};
----------------
Maybe write a direct comparison here instead of `evaluate`?
Having floating scores makes sense for completion, where lot's of different signals from multiple sources are taken into account and clients have to rescore on the client side.
Not so much for SignatureHelp, where we have all required information to compare the signatures is on clangd side and clients won't need to rescore.

A comparison operator should be easier to reason about, though.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50555





More information about the cfe-commits mailing list