public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] hir: SimplePath: Add location info
@ 2022-06-08 12:43 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:43 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:52b5286a69d86a36e279bc636cc41cbdd6795dee
commit 52b5286a69d86a36e279bc636cc41cbdd6795dee
Author: Arthur Cohen <arthur.cohen@embecosm.com>
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<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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:43 [gcc/devel/rust/master] hir: SimplePath: Add location info Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).