aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-07-04 16:56:46 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-07-08 12:46:30 +0100
commitfb27d1452b31d5485b1fce692f14279472cf0baf (patch)
tree362332a85d7d4e27ed53f91a2f8293817fafc856 /gcc/rust/ast
parent31887c00fbdc7d607cf79b1042cb84d2c6db17e2 (diff)
downloadgcc-fb27d1452b31d5485b1fce692f14279472cf0baf.zip
gcc-fb27d1452b31d5485b1fce692f14279472cf0baf.tar.gz
gcc-fb27d1452b31d5485b1fce692f14279472cf0baf.tar.bz2
Refactor mappings class and HIR lowering to be consistent
In order to support loading extern crates and use statements we needed to clarify the usage of NodeId and HirId within gccrs. Each of these id's were nested behind the CrateNum but the type resolution, linting and code-gen passes do not support that level of nesting. In order to get metadata exports and imports working lets focus on gccrs supporting compilation of a single crate at a time. This means the crate prefix only matters for imports and limits the complexity here. Down the line there might be a way to leverage DefId's for all Path resolution which could solve this problem but significant refactoring would be required here to do this properly and its not nessecary for a basic working rust compiler.
Diffstat (limited to 'gcc/rust/ast')
-rw-r--r--gcc/rust/ast/rust-item.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index 94ffffb..4987674 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -1153,6 +1153,9 @@ public:
void accept_vis (ASTVisitor &vis) override;
+ const std::string &get_referenced_crate () const { return referenced_crate; }
+ const std::string &get_as_clause () const { return as_clause_name; }
+
// Override that adds extern crate name in decl to passed list of names.
void add_crate_name (std::vector<std::string> &names) const override
{