[PATCH] D88902: [json] Provide a means to delegate writing a value to another API

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 07:44:53 PDT 2020


sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
sammccall requested review of this revision.

(Based on D87170 <https://reviews.llvm.org/D87170> by dsanders)

I recently had need to call out to an external API to emit a JSON object as part
of one an LLVM tool was emitting. However, our JSON support didn't provide a way
to delegate part of the JSON output to that API.

Add rawValueBegin() and rawValueEnd() to maintain and check the internal state
while something else is writing to the stream. It's the users responsibility to
ensure that the resulting JSON output is still valid.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88902

Files:
  llvm/include/llvm/Support/JSON.h
  llvm/lib/Support/JSON.cpp
  llvm/unittests/Support/JSONTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88902.296462.patch
Type: text/x-patch
Size: 5390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201006/8c27ee32/attachment.bin>


More information about the llvm-commits mailing list