LLVM 20.0.0git
Classes | Public Member Functions | List of all members
llvm::json::Path Class Reference

A "cursor" marking a position within a Value. More...

#include "llvm/Support/JSON.h"

Classes

class  Root
 The root is the trivial Path to the root value. More...
 

Public Member Functions

void report (llvm::StringLiteral Message)
 Records that the value at the current path is invalid.
 
 Path (Root &R)
 The root may be treated as a Path.
 
Path index (unsigned Index) const
 Derives a path for an array element: this[Index].
 
Path field (StringRef Field) const
 Derives a path for an object field: this.Field.
 

Detailed Description

A "cursor" marking a position within a Value.

The Value is a tree, and this is the path from the root to the current node. This is used to associate errors with particular subobjects.

Definition at line 655 of file JSON.h.

Constructor & Destructor Documentation

◆ Path()

llvm::json::Path::Path ( Root R)
inline

The root may be treated as a Path.

Definition at line 665 of file JSON.h.

Member Function Documentation

◆ field()

Path llvm::json::Path::field ( StringRef  Field) const
inline

Derives a path for an object field: this.Field.

Definition at line 669 of file JSON.h.

Referenced by llvm::json::ObjectMapper::map(), and llvm::json::ObjectMapper::mapOptional().

◆ index()

Path llvm::json::Path::index ( unsigned  Index) const
inline

Derives a path for an array element: this[Index].

Definition at line 667 of file JSON.h.

References Index.

◆ report()

void llvm::json::Path::report ( llvm::StringLiteral  Message)

Records that the value at the current path is invalid.

Message is e.g. "expected number" and becomes part of the final error. This overwrites any previously written error message in the root.

Definition at line 211 of file JSON.cpp.

References P.

Referenced by llvm::json::ObjectMapper::map().


The documentation for this class was generated from the following files: