From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 1D99738936C8; Wed, 8 Jun 2022 12:43:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D99738936C8 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] hir: SimplePath: Add location info X-Act-Checkin: gcc X-Git-Author: Arthur Cohen X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: 1ea83c404e82d276524f8af3ac51bd23600bfd24 X-Git-Newrev: 52b5286a69d86a36e279bc636cc41cbdd6795dee Message-Id: <20220608124323.1D99738936C8@sourceware.org> Date: Wed, 8 Jun 2022 12:43:23 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2022 12:43:23 -0000 https://gcc.gnu.org/g:52b5286a69d86a36e279bc636cc41cbdd6795dee commit 52b5286a69d86a36e279bc636cc41cbdd6795dee Author: Arthur Cohen Date: Mon May 2 14:25:54 2022 +0200 hir: SimplePath: Add location info Diff: --- gcc/rust/hir/rust-ast-lower-item.cc | 3 ++- gcc/rust/hir/tree/rust-hir-item.h | 4 +--- 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 45072d36a7a..0d59d7f6f94 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 c1dcf7651f5..5f664af17eb 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 e3ad8384252..d153eae1c61 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 segments; Analysis::NodeMapping mappings; + Location locus; public: SimplePath (std::vector 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