aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic-path.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-01-04 09:19:06 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2024-01-04 09:19:06 -0500
commit05c99b1c7965f46f0ff17d5e8f4020a62c643ae5 (patch)
tree1add23c085696c5c95e5e06ff9083167d97924a1 /gcc/diagnostic-path.h
parent5743e1899d596497800f7d6f4273d535ea0abcdd (diff)
downloadgcc-05c99b1c7965f46f0ff17d5e8f4020a62c643ae5.zip
gcc-05c99b1c7965f46f0ff17d5e8f4020a62c643ae5.tar.gz
gcc-05c99b1c7965f46f0ff17d5e8f4020a62c643ae5.tar.bz2
analyzer: add sarif properties for checker events
As another followup to r14-6057-g12b67d1e13b3cf, optionally add SARIF property bags to threadFlowLocation objects when writing out diagnostic paths, and add analyzer-specific properties to them. This was useful for debugging PR analyzer/112790. gcc/analyzer/ChangeLog: * checker-event.cc: Include "diagnostic-format-sarif.h" and "tree-logical-location.h". (checker_event::maybe_add_sarif_properties): New. (superedge_event::maybe_add_sarif_properties): New. (superedge_event::superedge_event): Add comment. * checker-event.h (checker_event::maybe_add_sarif_properties): New decl. (superedge_event::maybe_add_sarif_properties): New decl. gcc/ChangeLog: * diagnostic-format-sarif.cc (sarif_builder::make_logical_location_object): Convert to... (make_sarif_logical_location_object): ...this. (sarif_builder::set_any_logical_locs_arr): Update for above change. (sarif_builder::make_thread_flow_location_object): Call maybe_add_sarif_properties on each diagnostic_event. * diagnostic-format-sarif.h (class logical_location): New forward decl. (make_sarif_logical_location_object): New decl. * diagnostic-path.h (class sarif_object): New forward decl. (diagnostic_event::maybe_add_sarif_properties): New vfunc. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/diagnostic-path.h')
-rw-r--r--gcc/diagnostic-path.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/diagnostic-path.h b/gcc/diagnostic-path.h
index 7f271ef..fb7abe8 100644
--- a/gcc/diagnostic-path.h
+++ b/gcc/diagnostic-path.h
@@ -24,6 +24,8 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h" /* for ATTRIBUTE_GCC_DIAG. */
#include "diagnostic-event-id.h"
+class sarif_object;
+
/* A diagnostic_path is an optional additional piece of metadata associated
with a diagnostic (via its rich_location).
@@ -157,6 +159,13 @@ class diagnostic_event
virtual meaning get_meaning () const = 0;
virtual diagnostic_thread_id_t get_thread_id () const = 0;
+
+ /* Hook for SARIF output to allow for adding diagnostic-specific
+ properties to the threadFlowLocation object's property bag. */
+ virtual void
+ maybe_add_sarif_properties (sarif_object &/*thread_flow_loc_obj*/) const
+ {
+ }
};
/* Abstract base class representing a thread of execution within