GCC Middle and Back End API Reference
gcc_json_context Class Reference

#include <json-diagnostic.h>

Inheritance diagram for gcc_json_context:
Collaboration diagram for gcc_json_context:

Public Member Functions

 gcc_json_context (const char *filename)
location_t make_location_for_point (const json::location_map::point &)
location_t make_location_for_range (const json::location_map::range &)
void record_range_for_value (json::value *jv, const range &r) final override
const json::location_map::rangeget_range_for_value (const json::value &jv) const
virtual void on_finished_parsing ()

Private Attributes

const char * m_filename
std::map< const json::value *, rangem_map_jv_to_range

Detailed Description

Diagnostics relating to JSON values.
   Copyright (C) 2026 Free Software Foundation, Inc.
   Contributed by David Malcolm <dmalcolm@redhat.com>.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Implementation of json::location_map for use with
GCC diagnostics.
Stores location information for json::value * from parsing, and
can generate location_t values for the.   

Constructor & Destructor Documentation

◆ gcc_json_context()

gcc_json_context::gcc_json_context ( const char * filename)
inline

References m_filename.

Member Function Documentation

◆ get_range_for_value()

const json::location_map::range & json::simple_location_map::get_range_for_value ( const json::value & jv) const
inlineinherited

References gcc_assert, and m_map_jv_to_range.

Referenced by emit_json_diagnostic().

◆ make_location_for_point()

location_t gcc_json_context::make_location_for_point ( const json::location_map::point & p)

◆ make_location_for_range()

location_t gcc_json_context::make_location_for_range ( const json::location_map::range & r)

◆ on_finished_parsing()

virtual void json::location_map::on_finished_parsing ( )
inlinevirtualinherited

◆ record_range_for_value()

void json::simple_location_map::record_range_for_value ( json::value * jv,
const range & r )
inlinefinaloverridevirtualinherited

Implements json::location_map.

References m_map_jv_to_range, and r.

Field Documentation

◆ m_filename

const char* gcc_json_context::m_filename
private

◆ m_map_jv_to_range

std::map<const json::value *, range> json::simple_location_map::m_map_jv_to_range
privateinherited

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