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  verb {
  VERB_unknown , VERB_acquire , VERB_release , VERB_enter ,
  VERB_exit , VERB_call , VERB_return , VERB_branch ,
  VERB_danger
}
 
enum  noun {
  NOUN_unknown , NOUN_taint , NOUN_sensitive , NOUN_function ,
  NOUN_lock , NOUN_memory , NOUN_resource
}
 
enum  property { PROPERTY_unknown , PROPERTY_true , PROPERTY_false }
 

Public Member Functions

virtual ~diagnostic_event ()
 
virtual location_t get_location () const =0
 
virtual int get_stack_depth () const =0
 
virtual label_text get_desc (bool can_colorize) const =0
 
virtual const logical_locationget_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_object &) 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

Enumerator
NOUN_unknown 
NOUN_taint 
NOUN_sensitive 
NOUN_function 
NOUN_lock 
NOUN_memory 
NOUN_resource 

◆ property

Enumerator
PROPERTY_unknown 
PROPERTY_true 
PROPERTY_false 

◆ verb

Enumerator
VERB_unknown 
VERB_acquire 
VERB_release 
VERB_enter 
VERB_exit 
VERB_call 
VERB_return 
VERB_branch 
VERB_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()

◆ get_location()

virtual location_t diagnostic_event::get_location ( ) const
pure virtual

◆ get_logical_location()

virtual const 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_object & ) const
inlinevirtual

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