From: Pierre-Emmanuel Patry Date: Fri, 23 Jun 2023 09:44:49 +0000 (+0200) Subject: gccrs: collector: Remove external container X-Git-Tag: basepoints/gcc-15~2430 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb791a1f72ce2cba815d880883107ce26d5f8d66;p=thirdparty%2Fgcc.git gccrs: collector: Remove external container The token collector was using an external container but it was later revealed that this whole reuse thing was not necessary. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::TokenCollector): Remove constructor, changing it to an implicit default constructor. * ast/rust-ast-collector.h: Change from container reference to direct container. * ast/rust-ast-dump.h: Change call to constructor. * expand/rust-macro-expand.h (struct MacroExpander): Likewise. Signed-off-by: Pierre-Emmanuel Patry --- diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index f14cb355e9f4..84caeb729b53 100644 --- a/gcc/rust/ast/rust-ast-collector.cc +++ b/gcc/rust/ast/rust-ast-collector.cc @@ -20,10 +20,6 @@ namespace Rust { namespace AST { -TokenCollector::TokenCollector (std::vector &container) - : tokens (container) -{} - std::vector TokenCollector::collect_tokens () const { diff --git a/gcc/rust/ast/rust-ast-collector.h b/gcc/rust/ast/rust-ast-collector.h index 1b314aca8c22..dc2840b3784d 100644 --- a/gcc/rust/ast/rust-ast-collector.h +++ b/gcc/rust/ast/rust-ast-collector.h @@ -30,7 +30,6 @@ namespace AST { class TokenCollector : public ASTVisitor { public: - TokenCollector (std::vector &container); bool output_trailing_commas = false; void visit (AST::Crate &crate); @@ -39,7 +38,7 @@ public: std::vector collect_tokens () const; private: - std::vector &tokens; + std::vector tokens; /** * Visit all items in given @collection, placing the separator in between but diff --git a/gcc/rust/ast/rust-ast-dump.h b/gcc/rust/ast/rust-ast-dump.h index c5b4ab125db4..ec72ba14c4ad 100644 --- a/gcc/rust/ast/rust-ast-dump.h +++ b/gcc/rust/ast/rust-ast-dump.h @@ -41,8 +41,7 @@ public: template void process (T &v) { - std::vector container; - TokenCollector collector (container); + TokenCollector collector; collector.visit (v); auto tokens = collector.collect_tokens (); diff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h index 378a7e25f509..839c543c9541 100644 --- a/gcc/rust/expand/rust-macro-expand.h +++ b/gcc/rust/expand/rust-macro-expand.h @@ -396,8 +396,7 @@ struct MacroExpander } } - std::vector tokens; - AST::TokenCollector collector (tokens); + AST::TokenCollector collector; collector.visit (item); @@ -428,8 +427,7 @@ struct MacroExpander } } - std::vector tokens; - AST::TokenCollector collector (tokens); + AST::TokenCollector collector; collector.visit (item); @@ -461,8 +459,7 @@ struct MacroExpander } } - std::vector tokens; - AST::TokenCollector collector (tokens); + AST::TokenCollector collector; collector.visit (item);