diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-04-04 15:56:02 +0200 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-04-05 08:09:09 +0000 |
commit | 4331f52f62aa9208c3be4db12bbae29d669ec77b (patch) | |
tree | 04e33ab8ca63f05b8aa65e1a15c1f3fb3fbaa99f /gcc | |
parent | 0b7b488405db57c06b5976069981536c11bfe0ad (diff) | |
download | gcc-4331f52f62aa9208c3be4db12bbae29d669ec77b.zip gcc-4331f52f62aa9208c3be4db12bbae29d669ec77b.tar.gz gcc-4331f52f62aa9208c3be4db12bbae29d669ec77b.tar.bz2 |
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>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/ast/rust-ast-tokenstream.cc | 16 |
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: |