[PATCH] D40596: [clangd] New conventions for JSON-marshalling functions, centralize machinery

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 30 13:31:38 PST 2017


sammccall marked 3 inline comments as done.
sammccall added inline comments.


================
Comment at: clangd/JSONExpr.h:71
+// The convention is to have a deserialize function findable via ADL:
+//     deserialize(const json::Expr&, T&)->bool
+// Deserializers are provided for:
----------------
ilya-biryukov wrote:
> The name `deserialize` may be a bit too general and prone to clashes with other code. Maybe choosing something a bit more specific like `json_deserialize` is a better option.
> On the other hand, we do the SFINAE trick to check the types are correct in `Expr` constructor, so we should be fine either way.
Yeah, these are a bit generic. Renamed to `toJSON`/`fromJSON` - not perfect names but they're short and I find it easier to remember which direction they convert in.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D40596





More information about the cfe-commits mailing list