diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-05-02 14:25:54 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-05-04 16:01:44 +0200 |
commit | 52b5286a69d86a36e279bc636cc41cbdd6795dee (patch) | |
tree | 139e63c083bc4e9295535facec77c566339d1025 | |
parent | 1ea83c404e82d276524f8af3ac51bd23600bfd24 (diff) | |
download | gcc-52b5286a69d86a36e279bc636cc41cbdd6795dee.zip gcc-52b5286a69d86a36e279bc636cc41cbdd6795dee.tar.gz gcc-52b5286a69d86a36e279bc636cc41cbdd6795dee.tar.bz2 |
hir: SimplePath: Add location info
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-item.cc | 3 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-item.h | 4 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-path.h | 9 |
3 files changed, 9 insertions, 7 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-item.cc b/gcc/rust/hir/rust-ast-lower-item.cc index 45072d3..0d59d7f 100644 --- a/gcc/rust/hir/rust-ast-lower-item.cc +++ b/gcc/rust/hir/rust-ast-lower-item.cc @@ -61,7 +61,8 @@ ASTLoweringSimplePath::lower (const AST::SimplePath &path) mappings->get_next_hir_id (crate_num), UNKNOWN_LOCAL_DEFID); - auto lowered = HIR::SimplePath (std::move (segments), mapping); + auto lowered + = HIR::SimplePath (std::move (segments), mapping, path.get_locus ()); mappings->insert_node_to_hir (crate_num, node_id, mapping.get_hirid ()); mappings->insert_simple_path (crate_num, node_id, &path); diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index c1dcf76..5f664af 100644 --- a/gcc/rust/hir/tree/rust-hir-item.h +++ b/gcc/rust/hir/tree/rust-hir-item.h @@ -581,9 +581,7 @@ public: // Creates an error visibility. static Visibility create_error () { - return Visibility (ERROR, - HIR::SimplePath ({}, - Analysis::NodeMapping::get_error ())); + return Visibility (ERROR, HIR::SimplePath::create_error ()); } VisType get_vis_type () const { return vis_type; } diff --git a/gcc/rust/hir/tree/rust-hir-path.h b/gcc/rust/hir/tree/rust-hir-path.h index e3ad838..d153eae 100644 --- a/gcc/rust/hir/tree/rust-hir-path.h +++ b/gcc/rust/hir/tree/rust-hir-path.h @@ -961,19 +961,22 @@ class SimplePath { std::vector<SimplePathSegment> segments; Analysis::NodeMapping mappings; + Location locus; public: SimplePath (std::vector<SimplePathSegment> segments, - Analysis::NodeMapping mappings) - : segments (std::move (segments)), mappings (mappings) + Analysis::NodeMapping mappings, Location locus) + : segments (std::move (segments)), mappings (mappings), locus (locus) {} static HIR::SimplePath create_error () { - return HIR::SimplePath ({}, Analysis::NodeMapping::get_error ()); + return HIR::SimplePath ({}, Analysis::NodeMapping::get_error (), + Location ()); } const Analysis::NodeMapping &get_mappings () const { return mappings; } + const Location &get_locus () const { return locus; } }; } // namespace HIR |