From 8a18261afd923151b8d2a37f667e4673b27acd3f Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 14 Jan 2021 15:25:27 -0500 Subject: [PATCH] analyzer: const fixes [PR98679] gcc/analyzer/ChangeLog: PR analyzer/98679 * analyzer.h (region_offset::operator==): Make const. * pending-diagnostic.h (pending_diagnostic::equal_p): Likewise. * store.h (binding_cluster::for_each_value): Likewise. (binding_cluster::for_each_binding): Likewise. --- gcc/analyzer/analyzer.h | 2 +- gcc/analyzer/pending-diagnostic.h | 2 +- gcc/analyzer/store.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/analyzer/analyzer.h b/gcc/analyzer/analyzer.h index f603802c0d6..6996092717c 100644 --- a/gcc/analyzer/analyzer.h +++ b/gcc/analyzer/analyzer.h @@ -169,7 +169,7 @@ public: return m_offset; } - bool operator== (const region_offset &other) + bool operator== (const region_offset &other) const { return (m_base_region == other.m_base_region && m_offset == other.m_offset diff --git a/gcc/analyzer/pending-diagnostic.h b/gcc/analyzer/pending-diagnostic.h index 79dc83edc32..571fc1b56b9 100644 --- a/gcc/analyzer/pending-diagnostic.h +++ b/gcc/analyzer/pending-diagnostic.h @@ -157,7 +157,7 @@ class pending_diagnostic /* Compare for equality with OTHER, which might be of a different subclass. */ - bool equal_p (const pending_diagnostic &other) + bool equal_p (const pending_diagnostic &other) const { /* Check for pointer equality on the IDs from get_kind. */ if (get_kind () != other.get_kind ()) diff --git a/gcc/analyzer/store.h b/gcc/analyzer/store.h index 366439ce2dd..2bcef6c398a 100644 --- a/gcc/analyzer/store.h +++ b/gcc/analyzer/store.h @@ -425,7 +425,7 @@ public: template void for_each_value (void (*cb) (const svalue *sval, T user_data), - T user_data) + T user_data) const { for (map_t::iterator iter = m_map.begin (); iter != m_map.end (); ++iter) cb ((*iter).second, user_data); @@ -459,7 +459,7 @@ public: const svalue *maybe_get_simple_value (store_manager *mgr) const; template - void for_each_binding (BindingVisitor &v) + void for_each_binding (BindingVisitor &v) const { for (map_t::iterator iter = m_map.begin (); iter != m_map.end (); ++iter) { -- 2.30.2