[PATCH] D51971: [clangd] Use JSON format in benchmark requests reader

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 12 07:41:58 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:21
 
+using clang::clangd::loadIndex;
+using clang::clangd::SymbolIndex;
----------------
We don't need the usings, just shorten the name on usage sites (usages are inside namespace clangd)


================
Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:39
 
-// This function processes user-provided Log file with fuzzy find requests in
-// the following format:
-//
-// fuzzyFind("UnqualifiedName", scopes=["clang::", "clang::clangd::"])
-//
-// It constructs vector of FuzzyFindRequests which is later used for the
-// benchmarks.
-std::vector<clang::clangd::FuzzyFindRequest> extractQueriesFromLogs() {
-  llvm::Regex RequestMatcher("fuzzyFind\\(\"([a-zA-Z]*)\", scopes=\\[(.*)\\]");
-  llvm::SmallVector<llvm::StringRef, 200> Matches;
-  std::ifstream InputStream(LogFilename);
+// Reads '\n'-separated FuzzyFindRequest JSON representations from user-provided
+// file.
----------------
Maybe read a JSON array from the file instead?
I.e. one would have to write `[{/*request1*/}, {/*request2*/}, ..]` instead of putting a request per line

Pros: we get valid json, can have prettified forms too.
Cons: might be a bit harder to construct the json array. But don't think it's a big deal.


https://reviews.llvm.org/D51971





More information about the cfe-commits mailing list