[llvm-dev] RFC: Adding a JSON library to LLVM Support
Patrick Boettcher via llvm-dev
llvm-dev at lists.llvm.org
Wed Nov 15 09:36:33 PST 2017
On Fri, 27 Oct 2017 21:53:24 +0200
Sam McCall via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> We don't have a dedicated JSON library in the LLVM tree, I'd like to
> add one. The pressing need is for clangd, but we have other tools that
> read/write JSON too.
>
> I'm proposing we write a new one, rather than importing a third-party
> library (licensing/integration reasons), on or extending
> YamlParser/YamlIO (usability/flexibility). I lean towards a design
> that parses a full DOM at once, and provides literal-like syntax for
> composing documents.
Sorry for the late response (too late?).
There is a "modern", header-only, well-tested JSON-library which I'm
using in several projects. It has a very active user- and
contributor-base.
https://github.com/nlohmann/json
It's awesome! ;-) (MIT-licensed)
> I've written a document laying out the reasons for taking this path,
> and my proposal for a design (with links to a prototype)
> https://docs.google.com/document/d/1OEF9IauWwNuSigZzvvbjc1cVS1uGHRyGTXaoy3DjqM4/edit
> (Comments are enabled, but high-level discussion probably belongs on
> the list instead.)
>
> What do you think? I'm particularly interested in which parts of LLVM
> produce/consume JSON (or might want to), and what they need. I'm
> mostly familiar with the stuff in clang-tools-extra.
CMake's compile-command output is in JSON. We are using it to quickly
get the whole compile-line (when compiling our project with clang) to
add the flags needed to generate the .ll .
regards,
--
Patrick.
More information about the llvm-dev
mailing list