From 375d8b5900725ef7076b51509e570373c379259d Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Tue, 25 Jan 2022 16:29:09 +0000 Subject: Add helpers to access each segment of the canonical path --- gcc/rust/util/rust-canonical-path.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc') diff --git a/gcc/rust/util/rust-canonical-path.h b/gcc/rust/util/rust-canonical-path.h index 8473df6..6ac8968 100644 --- a/gcc/rust/util/rust-canonical-path.h +++ b/gcc/rust/util/rust-canonical-path.h @@ -144,6 +144,17 @@ public: return segs.back ().first; } + const std::pair &get_seg_at (size_t index) const + { + rust_assert (index < size ()); + return segs.at (index); + } + + static bool segment_is_qualified_path (const std::string &seg) + { + return seg.find (" as ") != std::string::npos; + } + bool is_equal (const CanonicalPath &b) const { return get ().compare (b.get ()) == 0; -- cgit v1.1