[llvm-dev] Adding a third-party dependency in clang-tools-extra

Sam McCall via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 19 03:48:35 PDT 2017


clangd communicates with an editor via JSON-RPC. It parses JSON with
YAMLParser, which is awkward, and generates JSON with printf and friends,
which is miserable. Much of LLVM does things this way, but clangd does it a
lot.

I'd like to try replacing this with a JSON library. nlohmann/json[1] seems
like a reasonable fit: C++11 with exceptions optional, simple build, MIT
license.

I'd propose vendoring it under tools/clang/tools/extra/clangd/nlohmann-json
so there's no question of it "leaking" into runtimes as described in this
thread[2].
This also means it wouldn't solve llvm's general JSON-parser problem :-)

Any LLVM-level objections or concerns? (Whether that library is the right
technical choice for clangd can be discussed elsewhere, I think)
If anyone wants to argue that we *shouldn't* bury it in
clang/tools/extra/clangd, that's fine too!

Cheers, Sam

[1] https://github.com/nlohmann/json/blob/develop/src/json.hpp
[2] https://groups.google.com/d/msg/llvm-dev/2JHX3smXTpE/U-E32Yg0AAAJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171019/a09b572b/attachment.html>


More information about the llvm-dev mailing list