diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-09-06 14:34:45 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:09:31 +0100 |
commit | f915a3fe9027a8eececd16425d890480bfec2fe7 (patch) | |
tree | 2a2856407e495ba121c1f73e6122e31325dc852a /gcc | |
parent | 2d2fa103e125685f44e41f5500a6a2e98ffd91fb (diff) | |
download | gcc-f915a3fe9027a8eececd16425d890480bfec2fe7.zip gcc-f915a3fe9027a8eececd16425d890480bfec2fe7.tar.gz gcc-f915a3fe9027a8eececd16425d890480bfec2fe7.tar.bz2 |
gccrs: Add containers for proc macro collection mappings
Add one container for each kind of procedural macro mapping. Also add a
new structure to gather informations required for derive procedural
macros. Add different functions to fill those new containers.
gcc/rust/ChangeLog:
* backend/rust-compile-context.h (struct CustomDeriveInfo): Add
new derive procedural macro metadata information holder for
mappings.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index ff44c1e..79e3457 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -38,6 +38,13 @@ struct fncontext TyTy::BaseType *retty; }; +struct CustomDeriveInfo +{ + tree fndecl; + std::string trait_name; + std::vector<std::string> attributes; +}; + class Context { public: @@ -357,6 +364,18 @@ public: static hashval_t type_hasher (tree type); + void collect_attribute_proc_macro (tree fndecl) + { + attribute_macros.push_back (fndecl); + } + + void collect_bang_proc_macro (tree fndecl) { bang_macros.push_back (fndecl); } + + void collect_derive_proc_macro (CustomDeriveInfo macro) + { + custom_derive_macros.push_back (macro); + } + private: Resolver::Resolver *resolver; Resolver::TypeCheckContext *tyctx; @@ -381,6 +400,10 @@ private: std::map<HirId, tree> implicit_pattern_bindings; std::map<hashval_t, tree> main_variants; + std::vector<CustomDeriveInfo> custom_derive_macros; + std::vector<tree> attribute_macros; + std::vector<tree> bang_macros; + // closure bindings std::vector<HirId> closure_scope_bindings; std::map<HirId, std::map<HirId, tree>> closure_bindings; |