[gcc r14-7468] gccrs: ast: Fix inner attribute tokenstream

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:37:20 GMT 2024


https://gcc.gnu.org/g:5444ed27a8139d5d584859321a88cadaafdb1cb0

commit r14-7468-g5444ed27a8139d5d584859321a88cadaafdb1cb0
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Tue Apr 11 18:11:09 2023 +0200

    gccrs: ast: Fix inner attribute tokenstream
    
    Inner attribute did not output exclamation tokens as there was no way to
    differentiate inner from outer attributes previously.
    
    gcc/rust/ChangeLog:
    
            * ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix inner
            attribute tokenstream output.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/ast/rust-ast-tokenstream.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/rust/ast/rust-ast-tokenstream.cc b/gcc/rust/ast/rust-ast-tokenstream.cc
index 3e2fdfc9e7b..d4e23bfec70 100644
--- a/gcc/rust/ast/rust-ast-tokenstream.cc
+++ b/gcc/rust/ast/rust-ast-tokenstream.cc
@@ -155,6 +155,8 @@ void
 TokenStream::visit (Attribute &attrib)
 {
   tokens.push_back (Rust::Token::make (HASH, attrib.get_locus ()));
+  if (attrib.is_inner_attribute ())
+    tokens.push_back (Rust::Token::make (EXCLAM, Location ()));
   tokens.push_back (Rust::Token::make (LEFT_SQUARE, Location ()));
   visit (attrib.get_path ());


More information about the Gcc-cvs mailing list