[committed] Make cgraph_node::get_fun const

Message ID 20190927181547.15021-1-dmalcolm@redhat.com
State New
Headers show
Series
  • [committed] Make cgraph_node::get_fun const
Related show

Commit Message

David Malcolm Sept. 27, 2019, 6:15 p.m.
Obvious const-correctness fix; I need this for a patch kit
I'm working on.

Successfully bootstrapped&regrtested on x86_64-pc-linux-gnu.

Committed to trunk (r276190) under the "obvious" rule.

gcc/ChangeLog:
	* cgraph.c (cgraph_node::get_fun): Make const.
	* cgraph.h (cgraph_node::get_fun): Likewise.
---
 gcc/cgraph.c | 4 ++--
 gcc/cgraph.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
1.8.5.3

Patch

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 843891e..11032e4 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -3671,9 +3671,9 @@  cgraph_node::get_body (void)
 /* Return the DECL_STRUCT_FUNCTION of the function.  */
 
 struct function *
-cgraph_node::get_fun (void)
+cgraph_node::get_fun () const
 {
-  cgraph_node *node = this;
+  const cgraph_node *node = this;
   struct function *fun = DECL_STRUCT_FUNCTION (node->decl);
 
   while (!fun && node->clone_of)
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 4c54210..13818be 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -1131,7 +1131,7 @@  struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
   void release_body (bool keep_arguments = false);
 
   /* Return the DECL_STRUCT_FUNCTION of the function.  */
-  struct function *get_fun (void);
+  struct function *get_fun () const;
 
   /* cgraph_node is no longer nested function; update cgraph accordingly.  */
   void unnest (void);