https://gcc.gnu.org/g:1be7e1da3e0165ec880200115a9d1e082bd7da29

commit r17-5899-g1be7e1da3e0165ec880200115a9d1e082bd7da29
Author: Josef Melcr <[email protected]>
Date:   Tue Nov 3 16:47:38 2026 +0100

    Add missing consts to arguments in call_summary
    
    I noticed that the edges passed to call_summary are not marked const,
    even though they can be.  This patch adds the const qualifiers to the
    arguments and to cgraph_edge methods these functions call.
    
    gcc/ChangeLog:
    
            * cgraph.h: Add consts to cgraph_edge::get_uid.
            * symbol-summary.h (call_summary::get_create): Take const
            cgraph_edge pointer.
            (call_summary::get): Likewise.
            (call_summary::remove): Likewise.
            (call_summary::exists): Likewise.
    
    Signed-off-by: Josef Melcr <[email protected]>

Diff:
---
 gcc/cgraph.h         | 2 +-
 gcc/symbol-summary.h | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index cad7fb3c1279..e1341343fdd3 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -2112,7 +2112,7 @@ public:
   bool maybe_hot_p (sreal scale);
 
   /* Get unique identifier of the edge.  */
-  inline int get_uid ()
+  inline int get_uid () const
   {
     return m_uid;
   }
diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
index 01c2a481a7c0..7c037eb9a3b8 100644
--- a/gcc/symbol-summary.h
+++ b/gcc/symbol-summary.h
@@ -695,7 +695,7 @@ public:
 
   /* Getter for summary callgraph edge pointer.
      If a summary for an edge does not exist, it will be created.  */
-  T* get_create (cgraph_edge *edge)
+  T* get_create (const cgraph_edge *edge)
   {
     bool existed;
     T **v = &m_map.get_or_insert (edge->get_uid (), &existed);
@@ -706,7 +706,7 @@ public:
   }
 
   /* Getter for summary callgraph edge pointer.  */
-  T* get (cgraph_edge *edge) ATTRIBUTE_PURE
+  T* get (const cgraph_edge *edge) ATTRIBUTE_PURE
   {
     T **v = m_map.get (edge->get_uid ());
     return v == NULL ? NULL : *v;
@@ -714,7 +714,7 @@ public:
 
   /* Remove edge from summary.  */
   using call_summary_base<T>::remove;
-  void remove (cgraph_edge *edge)
+  void remove (const cgraph_edge *edge)
   {
     int uid = edge->get_uid ();
     T **v = m_map.get (uid);
@@ -726,7 +726,7 @@ public:
   }
 
   /* Return true if a summary for the given EDGE already exists.  */
-  bool exists (cgraph_edge *edge)
+  bool exists (const cgraph_edge *edge)
   {
     return m_map.get (edge->get_uid ()) != NULL;
   }

Reply via email to