[PATCH] D40564: [clangd] Simplify common JSON-parsing patterns in Protocol.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 03:02:50 PST 2017


ioeric accepted this revision.
ioeric added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: clangd/Protocol.cpp:56
+    assert(*this && "Must check this is an object before calling parse()");
+    if (const json::Expr *E = O->get(Prop)) {
+      return parse(*E, Out);
----------------
nit: no braces around one liners.


================
Comment at: clangd/Protocol.cpp:101
+  static bool parse(const json::Expr &E, llvm::Optional<T> &Out) {
+    if (E.asNull())
+      return true;
----------------
Should we set `Out` to `None` in this case?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D40564





More information about the cfe-commits mailing list