This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix division by zero when computing scores
ClosedPublic

Authored by kadircet on Jan 15 2021, 2:15 AM.

Details

Summary

NameMatch could be a float close to zero, in such cases we were
dividing by zero and moreover propogating a "NaN" to clients, which is invalid
per JSON.

This fixes the issue by only using Quality scores whenever the NameMatch is low,
as we do in CodeCompletion ranking.

Fixes https://github.com/clangd/clangd/issues/648.

Diff Detail

Event Timeline

kadircet created this revision.Jan 15 2021, 2:15 AM
kadircet requested review of this revision.Jan 15 2021, 2:15 AM
sammccall accepted this revision.Jan 18 2021, 5:56 AM
This revision is now accepted and ready to land.Jan 18 2021, 5:56 AM
This revision was automatically updated to reflect the committed changes.