GCC Middle and Back End API Reference
diagnostic_event Class Referenceabstract

#include <diagnostic-path.h>

Inheritance diagram for diagnostic_event:

Data Structures

struct  meaning

Public Types

enum class  verb {
  unknown , acquire , release , enter ,
  exit , call , return_ , branch ,
  danger
}
enum class  noun {
  unknown , taint , sensitive , function ,
  lock , memory , resource
}
enum class  property { unknown , true_ , false_ }

Public Member Functions

virtual ~diagnostic_event ()
virtual location_t get_location () const =0
virtual int get_stack_depth () const =0
virtual void print_desc (pretty_printer &pp) const =0
virtual logical_location get_logical_location () const =0
virtual meaning get_meaning () const =0
virtual bool connect_to_next_event_p () const =0
virtual diagnostic_thread_id_t get_thread_id () const =0
virtual void maybe_add_sarif_properties (sarif_builder &, sarif_object &) const
virtual std::unique_ptr< xml::documentmaybe_make_xml_state (bool debug) const
label_text get_desc (pretty_printer &ref_pp) const

Detailed Description

A diagnostic_path is an optional additional piece of metadata associated with a diagnostic (via its rich_location). It describes a sequence of events predicted by the compiler that lead to the problem occurring, with their locations in the user's source, and text descriptions. For example, the following error has a 3-event path: test.c: In function 'demo': test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter 29 | PyList_Append(list, item); | ^~~~~~~~~~~~~~~~~~~~~~~~~ 'demo': events 1-3 25 | list = PyList_New(0); | ^~~~~~~~~~~~~ | | | (1) when 'PyList_New' fails, returning NULL 26 | 27 | for (i = 0; i < count; i++) { | ~~~ | | | (2) when 'i < count' 28 | item = PyLong_FromLong(random()); 29 | PyList_Append(list, item); | ~~~~~~~~~~~~~~~~~~~~~~~~~ | | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1 The diagnostic-printing code has consolidated the path into a single run of events, since all the events are near each other and within the same function; more complicated examples (such as interprocedural paths) might be printed as multiple runs of events.
Abstract base classes, describing events within a path, and the paths themselves.
One event within a diagnostic_path.

Member Enumeration Documentation

◆ noun

enum class diagnostic_event::noun
strong
Enumerator
unknown 
taint 
sensitive 
function 
lock 
memory 
resource 

◆ property

enum class diagnostic_event::property
strong
Enumerator
unknown 
true_ 
false_ 

◆ verb

enum class diagnostic_event::verb
strong
Enumerator
unknown 
acquire 
release 
enter 
exit 
call 
return_ 
branch 
danger 

Constructor & Destructor Documentation

◆ ~diagnostic_event()

virtual diagnostic_event::~diagnostic_event ( )
inlinevirtual

Member Function Documentation

◆ connect_to_next_event_p()

virtual bool diagnostic_event::connect_to_next_event_p ( ) const
pure virtual

◆ get_desc()

label_text diagnostic_event::get_desc ( pretty_printer & ref_pp) const
Generate a label_text containing the description of this event (for debugging/logging purposes).

References pretty_printer::clone(), pp_formatted_text(), pp_show_color(), and print_desc().

◆ get_location()

virtual location_t diagnostic_event::get_location ( ) const
pure virtual

◆ get_logical_location()

virtual logical_location diagnostic_event::get_logical_location ( ) const
pure virtual

◆ get_meaning()

◆ get_stack_depth()

virtual int diagnostic_event::get_stack_depth ( ) const
pure virtual

◆ get_thread_id()

virtual diagnostic_thread_id_t diagnostic_event::get_thread_id ( ) const
pure virtual

◆ maybe_add_sarif_properties()

virtual void diagnostic_event::maybe_add_sarif_properties ( sarif_builder & ,
sarif_object &  ) const
inlinevirtual

◆ maybe_make_xml_state()

std::unique_ptr< xml::document > diagnostic_event::maybe_make_xml_state ( bool debug) const
virtual

◆ print_desc()


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