From: Pierre-Emmanuel Patry Date: Mon, 6 Jan 2025 14:53:31 +0000 (+0100) Subject: gccrs: Make foreverstack debug string const X-Git-Tag: basepoints/gcc-16~798 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=48d524e2ee0142199a5eed50c7aa247cef849e5c;p=thirdparty%2Fgcc.git gccrs: Make foreverstack debug string const 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 --- diff --git a/gcc/rust/resolve/rust-forever-stack.h b/gcc/rust/resolve/rust-forever-stack.h index 66e12668f71..661478bab9b 100644 --- a/gcc/rust/resolve/rust-forever-stack.h +++ b/gcc/rust/resolve/rust-forever-stack.h @@ -670,7 +670,7 @@ public: tl::optional to_rib (NodeId rib_id); tl::optional 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 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` */ diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index d3d78894671..1c83f6bda61 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -699,7 +699,7 @@ template void ForeverStack::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::stream_rib (std::stringstream &stream, const Rib &rib, template void ForeverStack::stream_node (std::stringstream &stream, unsigned indentation, - const ForeverStack::Node &node) + const ForeverStack::Node &node) const { auto indent = std::string (indentation, ' '); auto next = std::string (indentation + 4, ' '); @@ -750,7 +750,7 @@ ForeverStack::stream_node (std::stringstream &stream, unsigned indentation, template std::string -ForeverStack::as_debug_string () +ForeverStack::as_debug_string () const { std::stringstream stream;