[PATCH] D44720: [clangd] Simplify fuzzy matcher (sequence alignment) by removing some condition checks.

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 21 12:34:58 PDT 2018


MaskRay added inline comments.


================
Comment at: clangd/FuzzyMatch.h:61
   bool allowMatch(int P, int W) const;
-  int skipPenalty(int W, Action Last) const;
-  int matchBonus(int P, int W, Action Last) const;
+  int missScore(int W, Action Last) const;
+  int matchScore(int P, int W, Action Last) const;
----------------
MaskRay wrote:
> sammccall wrote:
> > FWIW, I don't think this is an improvement - I think the clarity of purpose in names is more useful than having consistent signs in this case.
> Keep `matchBonus` but rename `skipPenalty` to `missPenalty` ?
Also note in the original scheme, the skip score does not need to be negative. Because Scores[PatN][WordN][] is used and each path takes the same number of positions (WordN). We can add an offset to all positional scores to make all of them non-negative. In the new scheme it does make sense to make them negative, as each path has now different number of positions.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44720





More information about the cfe-commits mailing list