This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbf935a034b34: [clangd] Make categorical features 64 bit in 
DecisionForest Model. (authored by usaxena95).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97770

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


Index: clang-tools-extra/clangd/quality/CompletionModelCodegen.py
===================================================================
--- clang-tools-extra/clangd/quality/CompletionModelCodegen.py
+++ clang-tools-extra/clangd/quality/CompletionModelCodegen.py
@@ -131,18 +131,19 @@
                     feature, feature))
         elif f["kind"] == "ENUM":
             setters.append(
-                "void set%s(unsigned V) { %s = 1 << V; }" % (feature, feature))
+                "void set%s(unsigned V) { %s = 1LL << V; }" % (feature, 
feature))
         else:
             raise ValueError("Unhandled feature type.", f["kind"])
 
     # Class members represent all the features of the Example.
     class_members = [
-        "uint32_t %s = 0;" % f['name']
+        "uint%d_t %s = 0;"
+        % (64 if f["kind"] == "ENUM" else 32, f['name'])
         for f in features_json
     ]
     getters = [
-        "LLVM_ATTRIBUTE_ALWAYS_INLINE uint32_t get%s() const { return %s; }"
-        % (f['name'], f['name'])
+        "LLVM_ATTRIBUTE_ALWAYS_INLINE uint%d_t get%s() const { return %s; }"
+        % (64 if f["kind"] == "ENUM" else 32, f['name'], f['name'])
         for f in features_json
     ]
     nline = "\n  "
@@ -245,7 +246,7 @@
 
 %s
 
-#define BIT(X) (1 << X)
+#define BIT(X) (1LL << X)
 
 %s
 
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
@@ -51,7 +51,7 @@
                       : RandInt(20));
     E.setSemaSaysInScope(FlipCoin(0.5));      // Boolean.
     E.setScope(RandInt(4));                   // 4 Scopes.
-    E.setContextKind(RandInt(32));            // 32 Context kinds.
+    E.setContextKind(RandInt(36));            // 36 Context kinds.
     E.setIsInstanceMember(FlipCoin(0.5));     // Boolean.
     E.setHadContextType(FlipCoin(0.6));       // Boolean.
     E.setHadSymbolType(FlipCoin(0.6));        // Boolean.


Index: clang-tools-extra/clangd/quality/CompletionModelCodegen.py
===================================================================
--- clang-tools-extra/clangd/quality/CompletionModelCodegen.py
+++ clang-tools-extra/clangd/quality/CompletionModelCodegen.py
@@ -131,18 +131,19 @@
                     feature, feature))
         elif f["kind"] == "ENUM":
             setters.append(
-                "void set%s(unsigned V) { %s = 1 << V; }" % (feature, feature))
+                "void set%s(unsigned V) { %s = 1LL << V; }" % (feature, feature))
         else:
             raise ValueError("Unhandled feature type.", f["kind"])
 
     # Class members represent all the features of the Example.
     class_members = [
-        "uint32_t %s = 0;" % f['name']
+        "uint%d_t %s = 0;"
+        % (64 if f["kind"] == "ENUM" else 32, f['name'])
         for f in features_json
     ]
     getters = [
-        "LLVM_ATTRIBUTE_ALWAYS_INLINE uint32_t get%s() const { return %s; }"
-        % (f['name'], f['name'])
+        "LLVM_ATTRIBUTE_ALWAYS_INLINE uint%d_t get%s() const { return %s; }"
+        % (64 if f["kind"] == "ENUM" else 32, f['name'], f['name'])
         for f in features_json
     ]
     nline = "\n  "
@@ -245,7 +246,7 @@
 
 %s
 
-#define BIT(X) (1 << X)
+#define BIT(X) (1LL << X)
 
 %s
 
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
@@ -51,7 +51,7 @@
                       : RandInt(20));
     E.setSemaSaysInScope(FlipCoin(0.5));      // Boolean.
     E.setScope(RandInt(4));                   // 4 Scopes.
-    E.setContextKind(RandInt(32));            // 32 Context kinds.
+    E.setContextKind(RandInt(36));            // 36 Context kinds.
     E.setIsInstanceMember(FlipCoin(0.5));     // Boolean.
     E.setHadContextType(FlipCoin(0.6));       // Boolean.
     E.setHadSymbolType(FlipCoin(0.6));        // Boolean.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D97770: [clangd] Ma... Utkarsh Saxena via Phabricator via cfe-commits
    • [PATCH] D97770: [clang... Utkarsh Saxena via Phabricator via cfe-commits

Reply via email to