hokein updated this revision to Diff 172598.
hokein added a comment.

Address review comment.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54106

Files:
  clangd/index/dex/dexp/Dexp.cpp


Index: clangd/index/dex/dexp/Dexp.cpp
===================================================================
--- clangd/index/dex/dexp/Dexp.cpp
+++ clangd/index/dex/dexp/Dexp.cpp
@@ -50,8 +50,10 @@
 }
 
 std::vector<SymbolID> getSymbolIDsFromIndex(StringRef QualifiedName,
-                                            const SymbolIndex *Index) {
+                                            const SymbolIndex *Index,
+                                            unsigned Limit) {
   FuzzyFindRequest Request;
+  Request.Limit = Limit;
   // Remove leading "::" qualifier as FuzzyFind doesn't need leading "::"
   // qualifier for global scope.
   bool IsGlobalScope = QualifiedName.consume_front("::");
@@ -158,6 +160,11 @@
   cl::opt<std::string> Name{
       "name", cl::desc("Qualified name to look up."),
   };
+  cl::opt<unsigned> Limit{
+      "limit",
+      cl::init(10),
+      cl::desc("Max results to display"),
+  };
 
   void run() override {
     if (ID.getNumOccurrences() == 0 && Name.getNumOccurrences() == 0) {
@@ -173,7 +180,7 @@
       }
       IDs.push_back(*SID);
     } else {
-      IDs = getSymbolIDsFromIndex(Name, Index);
+      IDs = getSymbolIDsFromIndex(Name, Index, Limit);
     }
 
     LookupRequest Request;
@@ -216,7 +223,7 @@
       }
       IDs.push_back(*SID);
     } else {
-      IDs = getSymbolIDsFromIndex(Name, Index);
+      IDs = getSymbolIDsFromIndex(Name, Index, /*Limit=*/10);
     }
     RefsRequest RefRequest;
     RefRequest.IDs.insert(IDs.begin(), IDs.end());


Index: clangd/index/dex/dexp/Dexp.cpp
===================================================================
--- clangd/index/dex/dexp/Dexp.cpp
+++ clangd/index/dex/dexp/Dexp.cpp
@@ -50,8 +50,10 @@
 }
 
 std::vector<SymbolID> getSymbolIDsFromIndex(StringRef QualifiedName,
-                                            const SymbolIndex *Index) {
+                                            const SymbolIndex *Index,
+                                            unsigned Limit) {
   FuzzyFindRequest Request;
+  Request.Limit = Limit;
   // Remove leading "::" qualifier as FuzzyFind doesn't need leading "::"
   // qualifier for global scope.
   bool IsGlobalScope = QualifiedName.consume_front("::");
@@ -158,6 +160,11 @@
   cl::opt<std::string> Name{
       "name", cl::desc("Qualified name to look up."),
   };
+  cl::opt<unsigned> Limit{
+      "limit",
+      cl::init(10),
+      cl::desc("Max results to display"),
+  };
 
   void run() override {
     if (ID.getNumOccurrences() == 0 && Name.getNumOccurrences() == 0) {
@@ -173,7 +180,7 @@
       }
       IDs.push_back(*SID);
     } else {
-      IDs = getSymbolIDsFromIndex(Name, Index);
+      IDs = getSymbolIDsFromIndex(Name, Index, Limit);
     }
 
     LookupRequest Request;
@@ -216,7 +223,7 @@
       }
       IDs.push_back(*SID);
     } else {
-      IDs = getSymbolIDsFromIndex(Name, Index);
+      IDs = getSymbolIDsFromIndex(Name, Index, /*Limit=*/10);
     }
     RefsRequest RefRequest;
     RefRequest.IDs.insert(IDs.begin(), IDs.end());
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to