[clang-tools-extra] r335874 - [clangd] Use log10 instead of the natural logrithm for usage boost.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 28 09:51:12 PDT 2018


Author: ioeric
Date: Thu Jun 28 09:51:12 2018
New Revision: 335874

URL: http://llvm.org/viewvc/llvm-project?rev=335874&view=rev
Log:
[clangd] Use log10 instead of the natural logrithm for usage boost.

Modified:
    clang-tools-extra/trunk/clangd/Quality.cpp
    clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp

Modified: clang-tools-extra/trunk/clangd/Quality.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Quality.cpp?rev=335874&r1=335873&r2=335874&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/Quality.cpp (original)
+++ clang-tools-extra/trunk/clangd/Quality.cpp Thu Jun 28 09:51:12 2018
@@ -7,6 +7,7 @@
 //
 //===---------------------------------------------------------------------===//
 #include "Quality.h"
+#include <cmath>
 #include "URI.h"
 #include "index/Index.h"
 #include "clang/AST/ASTContext.h"
@@ -147,8 +148,8 @@ float SymbolQualitySignals::evaluate() c
 
   // This avoids a sharp gradient for tail symbols, and also neatly avoids the
   // question of whether 0 references means a bad symbol or missing data.
-  if (References >= 3)
-    Score *= std::log(References);
+  if (References >= 10)
+    Score *= std::log10(References);
 
   if (Deprecated)
     Score *= 0.1f;

Modified: clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp?rev=335874&r1=335873&r2=335874&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp Thu Jun 28 09:51:12 2018
@@ -136,7 +136,7 @@ TEST(QualityTests, SymbolQualitySignalsS
   EXPECT_LT(ReservedName.evaluate(), Default.evaluate());
 
   SymbolQualitySignals WithReferences, ManyReferences;
-  WithReferences.References = 10;
+  WithReferences.References = 20;
   ManyReferences.References = 1000;
   EXPECT_GT(WithReferences.evaluate(), Default.evaluate());
   EXPECT_GT(ManyReferences.evaluate(), WithReferences.evaluate());




More information about the cfe-commits mailing list