public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7982] gccrs: Add proc macros abstractions to crate structure
@ 2024-01-16 18:10 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5ea74345459e72a8cd5b9ff00d78428893251edd

commit r14-7982-g5ea74345459e72a8cd5b9ff00d78428893251edd
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Mon Jul 31 18:31:51 2023 +0200

    gccrs: Add proc macros abstractions to crate structure
    
    Add multiple setters for a crate object in order to add macro
    abstractions previously introduced.
    
    gcc/rust/ChangeLog:
    
            * ast/rust-ast.h (struct Crate): Add proc macro members.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/ast/rust-ast.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index b78c4291e7a..ca117842a24 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -2026,6 +2026,10 @@ struct Crate
 
   NodeId node_id;
 
+  std::vector<AttributeProcMacro> attribute_macros;
+  std::vector<CustomDeriveProcMacro> derive_macros;
+  std::vector<BangProcMacro> bang_macros;
+
 public:
   // Constructor
   Crate (std::vector<std::unique_ptr<Item>> items,
@@ -2088,6 +2092,16 @@ public:
   {
     items = std::move (new_items);
   }
+
+  void add_bang_macro (ProcMacro::Bang macro) { bang_macros.push_back (macro); }
+  void add_attribute_macro (ProcMacro::Attribute macro)
+  {
+    attribute_macros.push_back (macro);
+  }
+  void add_derive_macro (ProcMacro::CustomDerive macro)
+  {
+    derive_macros.push_back (macro);
+  }
 };
 
 // Base path expression AST node - abstract

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-16 18:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:10 [gcc r14-7982] gccrs: Add proc macros abstractions to crate structure Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).