From 21c46e84e8b461a2d80b6fb6c2a006a8552a52a6 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Tue, 4 Apr 2023 15:56:02 +0200 Subject: gccrs: ast: Fix attribute tokenstreams Attributes were not converted to a correct tokenstream, furthermore meta items containers and token trees attribute arguments were not even implemented. This commit fix the literal attribute type and implement both unimplemented types. gcc/rust/ChangeLog: * ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix existing and implement remaining attribute visitors. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/rust-ast-tokenstream.cc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'gcc') diff --git a/gcc/rust/ast/rust-ast-tokenstream.cc b/gcc/rust/ast/rust-ast-tokenstream.cc index 761e899..0db1e2c 100644 --- a/gcc/rust/ast/rust-ast-tokenstream.cc +++ b/gcc/rust/ast/rust-ast-tokenstream.cc @@ -159,27 +159,19 @@ TokenStream::visit (Attribute &attrib) if (attrib.has_attr_input ()) { - tokens.push_back (Rust::Token::make (EQUAL, Location ())); - switch (attrib.get_attr_input ().get_attr_input_type ()) { case AST::AttrInput::AttrInputType::LITERAL: { - auto &literal - = static_cast (attrib.get_attr_input ()) - .get_literal (); - auto value = literal.as_string (); - tokens.push_back (Rust::Token::make (DOUBLE_QUOTE, Location ())); - tokens.push_back (Rust::Token::make_string (literal.get_locus (), - std::move (value))); - tokens.push_back (Rust::Token::make (DOUBLE_QUOTE, Location ())); + visit (static_cast (attrib.get_attr_input ())); break; } case AST::AttrInput::AttrInputType::META_ITEM: { - // FIXME: Implement this + visit (static_cast ( + attrib.get_attr_input ())); break; } case AST::AttrInput::AttrInputType::TOKEN_TREE: { - // FIXME: Implement this + visit (static_cast (attrib.get_attr_input ())); break; } default: -- cgit v1.1