aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-hir-map.h
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-06-16 18:17:39 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2023-07-21 09:06:09 +0000
commit01c316bc2b661ee7db45c8246727a96a454bfcc1 (patch)
tree1a39383234a09e791d9fdf31eada323d55c4ec68 /gcc/rust/util/rust-hir-map.h
parent5539f28018b492b68db4c1b6af0c4fe3acbfb19f (diff)
downloadgcc-01c316bc2b661ee7db45c8246727a96a454bfcc1.zip
gcc-01c316bc2b661ee7db45c8246727a96a454bfcc1.tar.gz
gcc-01c316bc2b661ee7db45c8246727a96a454bfcc1.tar.bz2
resolve: Add extern crate proc macro collection
Create a mapping for procedural macros with their crate num. gcc/rust/ChangeLog: * metadata/rust-extern-crate.h: Add proc macro getter. * rust-session-manager.cc (Session::load_extern_crate): Collect mappings and create mappings. * util/rust-hir-map.cc: Add insertion and lookup functions for every mapping. * util/rust-hir-map.h: Add function prototypes. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/util/rust-hir-map.h')
-rw-r--r--gcc/rust/util/rust-hir-map.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h
index e4bb255..d1fbe59 100644
--- a/gcc/rust/util/rust-hir-map.h
+++ b/gcc/rust/util/rust-hir-map.h
@@ -283,6 +283,20 @@ public:
void insert_exported_macro (AST::MacroRulesDefinition &def);
std::vector<NodeId> &get_exported_macros ();
+ void insert_derive_proc_macros (CrateNum num,
+ std::vector<ProcMacro::CustomDerive> macros);
+ void insert_bang_proc_macros (CrateNum num,
+ std::vector<ProcMacro::Bang> macros);
+ void insert_attribute_proc_macros (CrateNum num,
+ std::vector<ProcMacro::Attribute> macros);
+
+ bool lookup_derive_proc_macros (CrateNum num,
+ std::vector<ProcMacro::CustomDerive> &macros);
+ bool lookup_bang_proc_macros (CrateNum num,
+ std::vector<ProcMacro::Bang> &macros);
+ bool lookup_attribute_proc_macros (CrateNum num,
+ std::vector<ProcMacro::Attribute> &macros);
+
void insert_derive_proc_macro (std::pair<std::string, std::string> hierachy,
ProcMacro::CustomDerive macro);
void insert_bang_proc_macro (std::pair<std::string, std::string> hierachy,
@@ -376,6 +390,14 @@ private:
std::vector<NodeId> exportedMacros;
// Procedural macros
+ std::map<CrateNum, std::vector<ProcMacro::CustomDerive>>
+ procmacrosDeriveMappings;
+
+ std::map<CrateNum, std::vector<ProcMacro::Bang>> procmacrosBangMappings;
+
+ std::map<CrateNum, std::vector<ProcMacro::Attribute>>
+ procmacrosAttributeMappings;
+
std::map<std::pair<std::string, std::string>, ProcMacro::CustomDerive>
procmacroDeriveMappings;