aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/analyzer')
-rw-r--r--gcc/analyzer/checker-event.h2
-rw-r--r--gcc/analyzer/checker-path.cc8
-rw-r--r--gcc/analyzer/checker-path.h4
3 files changed, 13 insertions, 1 deletions
diff --git a/gcc/analyzer/checker-event.h b/gcc/analyzer/checker-event.h
index d0935ac..4343641 100644
--- a/gcc/analyzer/checker-event.h
+++ b/gcc/analyzer/checker-event.h
@@ -91,7 +91,6 @@ public:
/* Implementation of diagnostic_event. */
location_t get_location () const final override { return m_loc; }
- tree get_fndecl () const final override { return m_effective_fndecl; }
int get_stack_depth () const final override { return m_effective_depth; }
const logical_location *get_logical_location () const final override
{
@@ -111,6 +110,7 @@ public:
maybe_add_sarif_properties (sarif_object &thread_flow_loc_obj) const override;
/* Additional functionality. */
+ tree get_fndecl () const { return m_effective_fndecl; }
int get_original_stack_depth () const { return m_original_depth; }
diff --git a/gcc/analyzer/checker-path.cc b/gcc/analyzer/checker-path.cc
index c836191..cfbbc0b 100644
--- a/gcc/analyzer/checker-path.cc
+++ b/gcc/analyzer/checker-path.cc
@@ -63,6 +63,14 @@ along with GCC; see the file COPYING3. If not see
namespace ana {
+bool
+checker_path::same_function_p (int event_idx_a,
+ int event_idx_b) const
+{
+ return (m_events[event_idx_a]->get_fndecl ()
+ == m_events[event_idx_b]->get_fndecl ());
+}
+
/* Print a single-line representation of this path to PP. */
void
diff --git a/gcc/analyzer/checker-path.h b/gcc/analyzer/checker-path.h
index 162ebb3..1aa56d2 100644
--- a/gcc/analyzer/checker-path.h
+++ b/gcc/analyzer/checker-path.h
@@ -63,6 +63,10 @@ public:
return m_events[idx];
}
+ bool
+ same_function_p (int event_idx_a,
+ int event_idx_b) const final override;
+
void dump (pretty_printer *pp) const;
void debug () const;