]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Make foreverstack debug string const
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Mon, 6 Jan 2025 14:53:31 +0000 (15:53 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:06:57 +0000 (13:06 +0100)
Those function should not change anything within the foreverstack, it
can therefore be made const.

gcc/rust/ChangeLog:

* resolve/rust-forever-stack.h: Make debug functions const.
* resolve/rust-forever-stack.hxx: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/resolve/rust-forever-stack.h
gcc/rust/resolve/rust-forever-stack.hxx

index 66e12668f71a527dbf3ea7ba7ede5a28bedb0a72..661478bab9b91411abc35783147af30e8346015a 100644 (file)
@@ -670,7 +670,7 @@ public:
   tl::optional<Rib &> to_rib (NodeId rib_id);
   tl::optional<const Rib &> to_rib (NodeId rib_id) const;
 
-  std::string as_debug_string ();
+  std::string as_debug_string () const;
 
   /**
    * Used to check if a module is a descendant of another module
@@ -752,9 +752,9 @@ private:
   std::reference_wrapper<Node> cursor_reference;
 
   void stream_rib (std::stringstream &stream, const Rib &rib,
-                  const std::string &next, const std::string &next_next);
+                  const std::string &next, const std::string &next_next) const;
   void stream_node (std::stringstream &stream, unsigned indentation,
-                   const Node &node);
+                   const Node &node) const;
 
   /* Helper types and functions for `resolve_path` */
 
index d3d78894671af1fc8de2cd6957023e766fe610cc..1c83f6bda613517d59733ec4b7f6b0ea8b7860c2 100644 (file)
@@ -699,7 +699,7 @@ template <Namespace N>
 void
 ForeverStack<N>::stream_rib (std::stringstream &stream, const Rib &rib,
                             const std::string &next,
-                            const std::string &next_next)
+                            const std::string &next_next) const
 {
   if (rib.get_values ().empty ())
     {
@@ -718,7 +718,7 @@ ForeverStack<N>::stream_rib (std::stringstream &stream, const Rib &rib,
 template <Namespace N>
 void
 ForeverStack<N>::stream_node (std::stringstream &stream, unsigned indentation,
-                             const ForeverStack<N>::Node &node)
+                             const ForeverStack<N>::Node &node) const
 {
   auto indent = std::string (indentation, ' ');
   auto next = std::string (indentation + 4, ' ');
@@ -750,7 +750,7 @@ ForeverStack<N>::stream_node (std::stringstream &stream, unsigned indentation,
 
 template <Namespace N>
 std::string
-ForeverStack<N>::as_debug_string ()
+ForeverStack<N>::as_debug_string () const
 {
   std::stringstream stream;