[PATCH] D97620: Fix DecisionForestBenchmark.cpp compile errors

Utkarsh Saxena via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 2 01:28:31 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGbad8e577f9c7: Fix DecisionForestBenchmark.cpp compile errors (authored by usaxena95).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97620/new/

https://reviews.llvm.org/D97620

Files:
  clang-tools-extra/clangd/benchmarks/CompletionModel/DecisionForestBenchmark.cpp


Index: clang-tools-extra/clangd/benchmarks/CompletionModel/DecisionForestBenchmark.cpp
===================================================================
--- clang-tools-extra/clangd/benchmarks/CompletionModel/DecisionForestBenchmark.cpp
+++ clang-tools-extra/clangd/benchmarks/CompletionModel/DecisionForestBenchmark.cpp
@@ -21,7 +21,7 @@
 namespace clangd {
 namespace {
 std::vector<Example> generateRandomDataset(int NumExamples) {
-  auto FlipCoin = [&](float Probability) {
+  auto FlipCoin = [&](double Probability) {
     return rand() % 1000 <= Probability * 1000;
   };
   auto RandInt = [&](int Max) { return rand() % Max; };
@@ -38,15 +38,15 @@
     E.setIsImplementationDetail(FlipCoin(0.3)); // Boolean.
     E.setNumReferences(RandInt(10000));         // Can be large integer.
     E.setSymbolCategory(RandInt(10));           // 10 Symbol Category.
-
+    E.setNumNameInContext(RandInt(20));         // 0 to ContextWords->size().
+    E.setFractionNameInContext(RandFloat(1.0)); // Float in range [0,1].
     E.setIsNameInContext(FlipCoin(0.5)); // Boolean.
-    E.setIsForbidden(FlipCoin(0.1));     // Boolean.
     E.setIsInBaseClass(FlipCoin(0.3));   // Boolean.
-    E.setFileProximityDistance(
+    E.setFileProximityDistanceCost(
         FlipCoin(0.1) ? 999999 // Sometimes file distance is not available.
                       : RandInt(20));
     E.setSemaFileProximityScore(RandFloat(1)); // Float in range [0,1].
-    E.setSymbolScopeDistance(
+    E.setSymbolScopeDistanceCost(
         FlipCoin(0.1) ? 999999 // Sometimes scope distance is not available.
                       : RandInt(20));
     E.setSemaSaysInScope(FlipCoin(0.5));      // Boolean.
@@ -56,7 +56,6 @@
     E.setHadContextType(FlipCoin(0.6));       // Boolean.
     E.setHadSymbolType(FlipCoin(0.6));        // Boolean.
     E.setTypeMatchesPreferred(FlipCoin(0.5)); // Boolean.
-    E.setFilterLength(RandInt(15));
     Examples.push_back(E);
   }
   return Examples;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97620.327383.patch
Type: text/x-patch
Size: 1968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210302/8bcefd7c/attachment-0001.bin>


More information about the cfe-commits mailing list