[PATCH] D40406: [clangd] Switch from YAMLParser to JSONExpr

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 24 02:49:11 PST 2017


ioeric added inline comments.


================
Comment at: clangd/JSONRPCDispatcher.cpp:221
+        Out.log("<-- " + JSONRef + "\n");
+        handleAllErrors(Doc.takeError(), [&](const llvm::ErrorInfoBase &Err) {
+          Out.log(llvm::Twine("JSON parse error: ") + Err.message() + "\n");
----------------
Use `llvm::toString`?


================
Comment at: clangd/JSONRPCDispatcher.h:47
+  // Whether output should be pretty-printed.
+  const bool Pretty;
+
----------------
It seems that we are piggybacking a state of clangd with `JSONOutput`. It might make sense to store the option in clangd (or the dispatcher?) and pass it via `writeMessage`, but what you have is also fine if it saves trouble :)


https://reviews.llvm.org/D40406





More information about the cfe-commits mailing list