[COMMITTED] Add missing consts to arguments in call_summary
Checks
Commit Message
Hi,
this patch adds marks the arguments of call_summary methods const, as
well as making get_uid const. I didn't attempt to make add consts to
hooks, as they are frequently overridden.
Bootstrapped and regtested, pushed as obvious.
Best regards,
Josef
-- >8 --
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 <josef.melcr@suse.com>
---
gcc/cgraph.h | 2 +-
gcc/symbol-summary.h | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
@@ -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;
}
@@ -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;
}