[PATCH] D88985: [clangd] Temporary fix for bad inference in Decision Forest.
Utkarsh Saxena via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 7 10:25:43 PDT 2020
usaxena95 created this revision.
usaxena95 added a reviewer: adamcz.
Herald added subscribers: cfe-commits, kadircet, arphaman.
Herald added a project: clang.
usaxena95 requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.
Unreachable file distances are represented as
`std::numeric_limits<unsigned>::max()`.
The dataset recorded the signals as signed int capturing this default
value as `-1`.
The dataset needs to regenerated and a new model is required that
interprets this unreachable as the intended value.
This temporarily fixes this by interpreting unreachable distance as `-1`
and would be removed once we have the correct model.
One can look of these occurrences by searching for `-0.5` in
clang-tools-extra/clangd/quality/model/forest.json.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88985
Files:
clang-tools-extra/clangd/Quality.cpp
Index: clang-tools-extra/clangd/Quality.cpp
===================================================================
--- clang-tools-extra/clangd/Quality.cpp
+++ clang-tools-extra/clangd/Quality.cpp
@@ -502,8 +502,17 @@
E.setIsForbidden(Relevance.Forbidden);
E.setIsInBaseClass(Relevance.InBaseClass);
E.setFileProximityDistance(Derived.FileProximityDistance);
+ // FIXME(usx): Remove interpretation of Unreachable distance as -1 once we
+ // have a new model.
+ E.setFileProximityDistance(Derived.FileProximityDistance ==
+ FileDistance::Unreachable
+ ? -1
+ : Derived.FileProximityDistance);
E.setSemaFileProximityScore(Relevance.SemaFileProximityScore);
- E.setSymbolScopeDistance(Derived.ScopeProximityDistance);
+ E.setSymbolScopeDistance(Derived.ScopeProximityDistance ==
+ FileDistance::Unreachable
+ ? -1
+ : Derived.ScopeProximityDistance);
E.setSemaSaysInScope(Relevance.SemaSaysInScope);
E.setScope(Relevance.Scope);
E.setContextKind(Relevance.Context);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88985.296731.patch
Type: text/x-patch
Size: 1180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201007/e0f1c4d5/attachment.bin>
More information about the cfe-commits
mailing list