]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: ast: Fix inner attribute tokenstream
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 11 Apr 2023 16:11:09 +0000 (18:11 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:28:46 +0000 (18:28 +0100)
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>
gcc/rust/ast/rust-ast-tokenstream.cc

index 3e2fdfc9e7b3d2ef1d74c663243ae60fad5f4921..d4e23bfec7064acc353e5547f105fc7b7e05ab92 100644 (file)
@@ -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 ());