diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-01-25 16:29:09 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-01-29 14:17:44 +0000 |
commit | 375d8b5900725ef7076b51509e570373c379259d (patch) | |
tree | 7b5c1ad3fa92d6c9fba6239086a066ab6cc0cb87 /gcc | |
parent | 63429653c1aed3fd5e9d1de5d75c1831351855eb (diff) | |
download | gcc-375d8b5900725ef7076b51509e570373c379259d.zip gcc-375d8b5900725ef7076b51509e570373c379259d.tar.gz gcc-375d8b5900725ef7076b51509e570373c379259d.tar.bz2 |
Add helpers to access each segment of the canonical path
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/util/rust-canonical-path.h | 11 |
1 files changed, 11 insertions, 0 deletions
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<NodeId, std::string> &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; |