aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-hir-map.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-12-16 13:08:09 +0000
committerGitHub <noreply@github.com>2021-12-16 13:08:09 +0000
commitde1ed2e805cc7de7ab29b5e183354bae86173669 (patch)
treedf2bc819e07affe08e13d8f09f8448c00ae4722a /gcc/rust/util/rust-hir-map.h
parent8507a68883438060b3b8e828069ffe20a084b85a (diff)
parent4d70990b838e3fbeedaf0918c2c87f46cdf0d689 (diff)
downloadgcc-de1ed2e805cc7de7ab29b5e183354bae86173669.zip
gcc-de1ed2e805cc7de7ab29b5e183354bae86173669.tar.gz
gcc-de1ed2e805cc7de7ab29b5e183354bae86173669.tar.bz2
Merge #838
838: Add mssing mappings to HIR::Pattern r=philberty a=philberty These mappings are missing within the HIR but are required to complete typechecking of all patterns in match arms. As the fields of structures must bind their associated field's types to new names declared as part of the pattern, these mappings give access to the associated name-resolved NodeId's to figure this out. Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/util/rust-hir-map.h')
-rw-r--r--gcc/rust/util/rust-hir-map.h42
1 files changed, 23 insertions, 19 deletions
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h
index 77a4caf..f1f723b 100644
--- a/gcc/rust/util/rust-hir-map.h
+++ b/gcc/rust/util/rust-hir-map.h
@@ -347,6 +347,9 @@ public:
HIR::StructExprField *type);
HIR::StructExprField *lookup_hir_struct_field (CrateNum crateNum, HirId id);
+ void insert_hir_pattern (CrateNum crateNum, HirId id, HIR::Pattern *pattern);
+ HIR::Pattern *lookup_hir_pattern (CrateNum crateNum, HirId id);
+
void walk_local_defids_for_crate (CrateNum crateNum,
std::function<bool (HIR::Item *)> cb);
@@ -479,43 +482,44 @@ private:
std::map<CrateNum, HIR::Crate *> hirCrateMappings;
std::map<DefId, HIR::Item *> defIdMappings;
- std::map<CrateNum, std::map<LocalDefId, HIR::Item *> > localDefIdMappings;
- std::map<CrateNum, std::map<HirId, HIR::Module *> > hirModuleMappings;
- std::map<CrateNum, std::map<HirId, HIR::Item *> > hirItemMappings;
- std::map<CrateNum, std::map<HirId, HIR::Type *> > hirTypeMappings;
- std::map<CrateNum, std::map<HirId, HIR::Expr *> > hirExprMappings;
- std::map<CrateNum, std::map<HirId, HIR::Stmt *> > hirStmtMappings;
- std::map<CrateNum, std::map<HirId, HIR::FunctionParam *> > hirParamMappings;
- std::map<CrateNum, std::map<HirId, HIR::StructExprField *> >
+ std::map<CrateNum, std::map<LocalDefId, HIR::Item *>> localDefIdMappings;
+ std::map<CrateNum, std::map<HirId, HIR::Module *>> hirModuleMappings;
+ std::map<CrateNum, std::map<HirId, HIR::Item *>> hirItemMappings;
+ std::map<CrateNum, std::map<HirId, HIR::Type *>> hirTypeMappings;
+ std::map<CrateNum, std::map<HirId, HIR::Expr *>> hirExprMappings;
+ std::map<CrateNum, std::map<HirId, HIR::Stmt *>> hirStmtMappings;
+ std::map<CrateNum, std::map<HirId, HIR::FunctionParam *>> hirParamMappings;
+ std::map<CrateNum, std::map<HirId, HIR::StructExprField *>>
hirStructFieldMappings;
- std::map<CrateNum, std::map<HirId, std::pair<HirId, HIR::ImplItem *> > >
+ std::map<CrateNum, std::map<HirId, std::pair<HirId, HIR::ImplItem *>>>
hirImplItemMappings;
- std::map<CrateNum, std::map<HirId, HIR::SelfParam *> > hirSelfParamMappings;
+ std::map<CrateNum, std::map<HirId, HIR::SelfParam *>> hirSelfParamMappings;
std::map<HirId, HIR::ImplBlock *> hirImplItemsToImplMappings;
- std::map<CrateNum, std::map<HirId, HIR::ImplBlock *> > hirImplBlockMappings;
- std::map<CrateNum, std::map<HirId, HIR::TraitItem *> > hirTraitItemMappings;
- std::map<CrateNum, std::map<HirId, HIR::ExternalItem *> >
+ std::map<CrateNum, std::map<HirId, HIR::ImplBlock *>> hirImplBlockMappings;
+ std::map<CrateNum, std::map<HirId, HIR::TraitItem *>> hirTraitItemMappings;
+ std::map<CrateNum, std::map<HirId, HIR::ExternalItem *>>
hirExternItemMappings;
- std::map<CrateNum, std::map<HirId, HIR::PathExprSegment *> >
+ std::map<CrateNum, std::map<HirId, HIR::PathExprSegment *>>
hirPathSegMappings;
- std::map<CrateNum, std::map<HirId, HIR::GenericParam *> >
+ std::map<CrateNum, std::map<HirId, HIR::GenericParam *>>
hirGenericParamMappings;
std::map<HirId, HIR::Trait *> hirTraitItemsToTraitMappings;
+ std::map<CrateNum, std::map<HirId, HIR::Pattern *>> hirPatternMappings;
// this maps the lang=<item_type> to DefId mappings
std::map<RustLangItem::ItemType, DefId> lang_item_mappings;
// canonical paths
- std::map<CrateNum, std::map<NodeId, const Resolver::CanonicalPath> > paths;
+ std::map<CrateNum, std::map<NodeId, const Resolver::CanonicalPath>> paths;
// location info
- std::map<CrateNum, std::map<NodeId, Location> > locations;
+ std::map<CrateNum, std::map<NodeId, Location>> locations;
// reverse mappings
- std::map<CrateNum, std::map<NodeId, HirId> > nodeIdToHirMappings;
+ std::map<CrateNum, std::map<NodeId, HirId>> nodeIdToHirMappings;
// all hirid nodes
- std::map<CrateNum, std::set<HirId> > hirNodesWithinCrate;
+ std::map<CrateNum, std::set<HirId>> hirNodesWithinCrate;
// crate names
std::map<CrateNum, std::string> crate_names;