class OStream

Declaration

class OStream { /* full declaration omitted */ };

Description

for (const Event &E : Events) { J.objectBegin(); J.attribute("timestamp", int64_t(E.Time)); J.attributeBegin("participants"); for (const Participant &P : E.Participants) J.value(P.toString()); J.attributeEnd(); J.objectEnd(); } J.arrayEnd(); If the call sequence isn't valid JSON, asserts will fire in debug mode. This can be mismatched begin()/end() pairs, trying to emit attributes inside an array, and so on. With asserts disabled, this is undefined behavior.

Declared at: llvm/include/llvm/Support/JSON.h:955

Member Variables

private llvm::SmallVector<State, 16> Stack
private llvm::StringRef PendingComment
private llvm::raw_ostream& OS
private unsigned int IndentSize
private unsigned int Indent = 0

Method Overview

Methods

OStream(llvm::raw_ostream& OS,
        unsigned int IndentSize = 0)

Declared at: llvm/include/llvm/Support/JSON.h:959

Parameters

llvm::raw_ostream& OS
unsigned int IndentSize = 0

void array(llvm::json::OStream::Block Contents)

Description

Emit an array whose elements are emitted in the provided Block.

Declared at: llvm/include/llvm/Support/JSON.h:979

Parameters

llvm::json::OStream::Block Contents

void arrayBegin()

Declared at: llvm/include/llvm/Support/JSON.h:1025

void arrayEnd()

Declared at: llvm/include/llvm/Support/JSON.h:1026

void attribute(llvm::StringRef Key,
               const llvm::json::Value& Contents)

Description

Emit an attribute whose value is self-contained (number, vector <int > etc).

Declared at: llvm/include/llvm/Support/JSON.h:1010

Parameters

llvm::StringRef Key
const llvm::json::Value& Contents

void attributeArray(
    llvm::StringRef Key,
    llvm::json::OStream::Block Contents)

Description

Emit an attribute whose value is an array with elements from the Block.

Declared at: llvm/include/llvm/Support/JSON.h:1014

Parameters

llvm::StringRef Key
llvm::json::OStream::Block Contents

void attributeBegin(llvm::StringRef Key)

Declared at: llvm/include/llvm/Support/JSON.h:1029

Parameters

llvm::StringRef Key

void attributeEnd()

Declared at: llvm/include/llvm/Support/JSON.h:1030

void attributeImpl(
    llvm::StringRef Key,
    llvm::json::OStream::Block Contents)

Declared at: llvm/include/llvm/Support/JSON.h:1035

Parameters

llvm::StringRef Key
llvm::json::OStream::Block Contents

void attributeObject(
    llvm::StringRef Key,
    llvm::json::OStream::Block Contents)

Description

Emit an attribute whose value is an object with attributes from the Block.

Declared at: llvm/include/llvm/Support/JSON.h:1018

Parameters

llvm::StringRef Key
llvm::json::OStream::Block Contents

void comment(llvm::StringRef)

Description

Emit a JavaScript comment associated with the next printed value. The string must be valid until the next attribute or value is emitted. Comments are not part of standard JSON, and many parsers reject them!

Declared at: llvm/include/llvm/Support/JSON.h:1004

Parameters

llvm::StringRef

void flush()

Description

Flushes the underlying ostream. OStream does not buffer internally.

Declared at: llvm/include/llvm/Support/JSON.h:970

void flushComment()

Declared at: llvm/include/llvm/Support/JSON.h:1042

void newline()

Declared at: llvm/include/llvm/Support/JSON.h:1043

void object(llvm::json::OStream::Block Contents)

Description

Emit an object whose elements are emitted in the provided Block.

Declared at: llvm/include/llvm/Support/JSON.h:985

Parameters

llvm::json::OStream::Block Contents

void objectBegin()

Declared at: llvm/include/llvm/Support/JSON.h:1027

void objectEnd()

Declared at: llvm/include/llvm/Support/JSON.h:1028

void rawValue(llvm::StringRef Contents)

Declared at: llvm/include/llvm/Support/JSON.h:998

Parameters

llvm::StringRef Contents

void rawValue(
    llvm::function_ref<void(raw_ostream&)>
        Contents)

Description

Emit an externally-serialized value. The caller must write exactly one valid JSON value to the provided stream. No validation or formatting of this value occurs.

Declared at: llvm/include/llvm/Support/JSON.h:993

Parameters

llvm::function_ref<void(raw_ostream&)> Contents

llvm::raw_ostream& rawValueBegin()

Declared at: llvm/include/llvm/Support/JSON.h:1031

void rawValueEnd()

Declared at: llvm/include/llvm/Support/JSON.h:1032

void value(const llvm::json::Value& V)

Description

Emit a self-contained value (number, string, vector <string > etc).

Declared at: llvm/include/llvm/Support/JSON.h:977

Parameters

const llvm::json::Value& V

void valueBegin()

Declared at: llvm/include/llvm/Support/JSON.h:1041

~OStream()

Declared at: llvm/include/llvm/Support/JSON.h:963