[all-commits] [llvm/llvm-project] a1d464: [clangd] Fix division by zero when computing scores

kadir çetinkaya via All-commits all-commits at lists.llvm.org
Wed Jan 20 03:55:41 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a1d4649a5b176bf826685cac5cc4416b6498bdf9
      https://github.com/llvm/llvm-project/commit/a1d4649a5b176bf826685cac5cc4416b6498bdf9
  Author: Kadir Cetinkaya <kadircet at google.com>
  Date:   2021-01-20 (Wed, 20 Jan 2021)

  Changed paths:
    M clang-tools-extra/clangd/CodeComplete.cpp
    M clang-tools-extra/clangd/FindSymbols.cpp

  Log Message:
  -----------
  [clangd] Fix division by zero when computing scores

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.

Differential Revision: https://reviews.llvm.org/D94755




More information about the All-commits mailing list