[gcc r14-7982] gccrs: Add proc macros abstractions to crate structure
Arthur Cohen
cohenarthur@gcc.gnu.org
Tue Jan 16 18:10:50 GMT 2024
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
More information about the Gcc-cvs
mailing list