From 43c1ab08f070994a934d90ff4e6457eaee12c493 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Sun, 8 Aug 2021 19:48:55 +0100 Subject: add missing copy constructors and equality interfaces --- gcc/rust/util/rust-hir-map.cc | 7 ------- gcc/rust/util/rust-hir-map.h | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'gcc') diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index 4ffbff0..0f8f902 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -23,13 +23,6 @@ namespace Rust { namespace Analysis { -NodeMapping::NodeMapping (CrateNum crateNum, NodeId nodeId, HirId hirId, - LocalDefId localDefId) - : crateNum (crateNum), nodeId (nodeId), hirId (hirId), localDefId (localDefId) -{} - -NodeMapping::~NodeMapping () {} - NodeMapping NodeMapping::get_error () { diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h index ccc873b..f689abf 100644 --- a/gcc/rust/util/rust-hir-map.h +++ b/gcc/rust/util/rust-hir-map.h @@ -53,8 +53,10 @@ class NodeMapping { public: NodeMapping (CrateNum crateNum, NodeId nodeId, HirId hirId, - LocalDefId localDefId); - ~NodeMapping (); + LocalDefId localDefId) + : crateNum (crateNum), nodeId (nodeId), hirId (hirId), + localDefId (localDefId) + {} static NodeMapping get_error (); @@ -68,6 +70,14 @@ public: std::string as_string () const; + bool is_equal (const NodeMapping &other) const + { + return get_crate_num () == other.get_crate_num () + && get_nodeid () == other.get_nodeid () + && get_hirid () == other.get_hirid () + && get_local_defid () == other.get_local_defid (); + } + private: CrateNum crateNum; NodeId nodeId; -- cgit v1.1