llvm/llvm/lib/Support/JSON.cpp

//=== JSON.cpp - JSON value, parsing and serialization - C++ -----------*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------------------------------------------------===//

#include "llvm/Support/JSON.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/NativeFormatting.h"
#include "llvm/Support/raw_ostream.h"
#include <cctype>
#include <cerrno>
#include <optional>

namespace llvm {
namespace json {

Value &Object::operator[](const ObjectKey &K) {}
Value &Object::operator[](ObjectKey &&K) {}
Value *Object::get(StringRef K) {}
const Value *Object::get(StringRef K) const {}
std::optional<std::nullptr_t> Object::getNull(StringRef K) const {}
std::optional<bool> Object::getBoolean(StringRef K) const {}
std::optional<double> Object::getNumber(StringRef K) const {}
std::optional<int64_t> Object::getInteger(StringRef K) const {}
std::optional<llvm::StringRef> Object::getString(StringRef K) const {}
const json::Object *Object::getObject(StringRef K) const {}
json::Object *Object::getObject(StringRef K) {}
const json::Array *Object::getArray(StringRef K) const {}
json::Array *Object::getArray(StringRef K) {}
bool operator==(const Object &LHS, const Object &RHS) {}

Array::Array(std::initializer_list<Value> Elements) {}

Value::Value(std::initializer_list<Value> Elements)
    :{}

void Value::copyFrom(const Value &M) {}

void Value::moveFrom(const Value &&M) {}

void Value::destroy() {}

bool operator==(const Value &L, const Value &R) {}

void Path::report(llvm::StringLiteral Msg) {}

Error Path::Root::getError() const {}

std::vector<const Object::value_type *> sortedElements(const Object &O) {}

// Prints a one-line version of a value that isn't our main focus.
// We interleave writes to OS and JOS, exploiting the lack of extra buffering.
// This is OK as we own the implementation.
static void abbreviate(const Value &V, OStream &JOS) {}

// Prints a semi-expanded version of a value that is our main focus.
// Array/Object entries are printed, but not recursively as they may be huge.
static void abbreviateChildren(const Value &V, OStream &JOS) {}

void Path::Root::printErrorContext(const Value &R, raw_ostream &OS) const {}

namespace {
// Simple recursive-descent JSON parser.
class Parser {};
} // namespace

bool Parser::parseValue(Value &Out) {}

bool Parser::parseNumber(char First, Value &Out) {}

bool Parser::parseString(std::string &Out) {}

static void encodeUtf8(uint32_t Rune, std::string &Out) {}

// Parse a UTF-16 \uNNNN escape sequence. "\u" has already been consumed.
// May parse several sequential escapes to ensure proper surrogate handling.
// We do not use ConvertUTF.h, it can't accept and replace unpaired surrogates.
// These are invalid Unicode but valid JSON (RFC 8259, section 8.2).
bool Parser::parseUnicode(std::string &Out) {}

bool Parser::parseError(const char *Msg) {}

Expected<Value> parse(StringRef JSON) {}
char ParseError::ID =;

bool isUTF8(llvm::StringRef S, size_t *ErrOffset) {}

std::string fixUTF8(llvm::StringRef S) {}

static void quote(llvm::raw_ostream &OS, llvm::StringRef S) {}

void llvm::json::OStream::value(const Value &V) {}

void llvm::json::OStream::valueBegin() {}

void OStream::comment(llvm::StringRef Comment) {}

void OStream::flushComment() {}

void llvm::json::OStream::newline() {}

void llvm::json::OStream::arrayBegin() {}

void llvm::json::OStream::arrayEnd() {}

void llvm::json::OStream::objectBegin() {}

void llvm::json::OStream::objectEnd() {}

void llvm::json::OStream::attributeBegin(llvm::StringRef Key) {}

void llvm::json::OStream::attributeEnd() {}

raw_ostream &llvm::json::OStream::rawValueBegin() {}

void llvm::json::OStream::rawValueEnd() {}

} // namespace json
} // namespace llvm

void llvm::format_provider<llvm::json::Value>::format(
    const llvm::json::Value &E, raw_ostream &OS, StringRef Options) {}