[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 03:11:14 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:47
+  if (!JSONArray || !JSONArray->getAsArray()) {
+    llvm::errs() << "FATAL ERROR: Couldn't parse request.\n";
+    exit(1);
----------------
If there was a json parsing error, we should consume it and print to the user, i.e.
```
llvm::errs() << "Error when parsing json requests file: " << llvm::toString(std::move(JSONArray));
```

The user-facing error when an object is not an array should probably be a separate one.



================
Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:53
+    FuzzyFindRequest Request;
+    fromJSON(Item, Request);
+    Requests.push_back(Request);
----------------
Check for return value of `fromJSON` and also report an error if it failed?


https://reviews.llvm.org/D51971





More information about the cfe-commits mailing list