aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-04-04 15:56:02 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:28:44 +0100
commit21c46e84e8b461a2d80b6fb6c2a006a8552a52a6 (patch)
tree09e4f509cedb4dced3ce76da7bd91b599d8d3ca6
parentd8a7cee1ea6469615dc06d5d786182a279042637 (diff)
downloadgcc-21c46e84e8b461a2d80b6fb6c2a006a8552a52a6.zip
gcc-21c46e84e8b461a2d80b6fb6c2a006a8552a52a6.tar.gz
gcc-21c46e84e8b461a2d80b6fb6c2a006a8552a52a6.tar.bz2
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 <pierre-emmanuel.patry@embecosm.com>
-rw-r--r--gcc/rust/ast/rust-ast-tokenstream.cc16
1 files changed, 4 insertions, 12 deletions
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<AST::AttrInputLiteral &> (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<AttrInputLiteral &> (attrib.get_attr_input ()));
break;
}
case AST::AttrInput::AttrInputType::META_ITEM: {
- // FIXME: Implement this
+ visit (static_cast<AttrInputMetaItemContainer &> (
+ attrib.get_attr_input ()));
break;
}
case AST::AttrInput::AttrInputType::TOKEN_TREE: {
- // FIXME: Implement this
+ visit (static_cast<DelimTokenTree &> (attrib.get_attr_input ()));
break;
}
default: