Skip to content

Commit

Permalink
Make foreverstack debug string const
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
P-E-P committed Jan 6, 2025
1 parent 01060d0 commit 36a691c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions gcc/rust/resolve/rust-forever-stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ template <Namespace N> class ForeverStack
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
Expand Down Expand Up @@ -601,9 +601,9 @@ template <Namespace N> class ForeverStack
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` */

Expand Down
6 changes: 3 additions & 3 deletions gcc/rust/resolve/rust-forever-stack.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ())
{
Expand All @@ -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, ' ');
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 36a691c

Please sign in to comment.