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

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 13 06:43:34 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:48
+    llvm::errs() << "Error when parsing json requests file: "
+                 << llvm::toString(JSONArray.takeError());
+    exit(1);
----------------
We should only call `takeError()` when `JSONArray` is an error. Not an array value should be handled separately.

BTW, can we add tests with invalid inputs for both of these cases?


================
Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:56
+    if (!fromJSON(Item, Request)) {
+      llvm::errs() << "Error when parsing request.\n";
+      exit(1);
----------------
Maybe also output the request that failed to parse?
To help untangle the problem in case it happens.


https://reviews.llvm.org/D51971





More information about the cfe-commits mailing list