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.
can we have a rawValue(function_ref<void(raw_ostream&)>)?
The "low-level" ideas of raw-output and no-lexical-nesting are independent.
Providing the ostream as a parameter makes the usable lifetime clear.