public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8596] gccrs: HIR: add missing getters Date: Tue, 30 Jan 2024 12:00:24 +0000 (GMT) [thread overview] Message-ID: <20240130120026.116C73858011@sourceware.org> (raw) https://gcc.gnu.org/g:cc9465332ebcabebb04b95549989d74a8f1c0ce6 commit r14-8596-gcc9465332ebcabebb04b95549989d74a8f1c0ce6 Author: Jakub Dupak <dev@jakubdupak.com> Date: Sun Dec 3 11:07:04 2023 +0100 gccrs: HIR: add missing getters gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h: Ad lifetime getter. * hir/tree/rust-hir-path.h: Make getter const ref. * hir/tree/rust-hir.h: Const ref and new getter. Signed-off-by: Jakub Dupak <dev@jakubdupak.com> Diff: --- gcc/rust/hir/tree/rust-hir-item.h | 2 ++ gcc/rust/hir/tree/rust-hir-path.h | 4 ++++ gcc/rust/hir/tree/rust-hir.h | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index f72d8c8b0501..74450786e89a 100644 --- a/gcc/rust/hir/tree/rust-hir-item.h +++ b/gcc/rust/hir/tree/rust-hir-item.h @@ -443,6 +443,8 @@ public: // Returns whether the self-param has a valid lifetime. bool has_lifetime () const { return !lifetime.is_error (); } + const Lifetime &get_lifetime () const { return lifetime; } + // Returns whether the self-param is in an error state. bool is_error () const { return self_kind == ImplicitSelfKind::NONE; } diff --git a/gcc/rust/hir/tree/rust-hir-path.h b/gcc/rust/hir/tree/rust-hir-path.h index 9fe126a56a8d..0566e2e2a1cb 100644 --- a/gcc/rust/hir/tree/rust-hir-path.h +++ b/gcc/rust/hir/tree/rust-hir-path.h @@ -218,6 +218,10 @@ public: std::string as_string () const; std::vector<Lifetime> &get_lifetime_args () { return lifetime_args; } + const std::vector<Lifetime> &get_lifetime_args () const + { + return lifetime_args; + } std::vector<std::unique_ptr<Type> > &get_type_args () { return type_args; } diff --git a/gcc/rust/hir/tree/rust-hir.h b/gcc/rust/hir/tree/rust-hir.h index 0f2d52256d2f..f66f53fbd204 100644 --- a/gcc/rust/hir/tree/rust-hir.h +++ b/gcc/rust/hir/tree/rust-hir.h @@ -572,7 +572,10 @@ public: void accept_vis (HIRFullVisitor &vis) override; - std::string get_name () const { return lifetime_name; } + WARN_UNUSED_RESULT const std::string &get_name () const + { + return lifetime_name; + } AST::Lifetime::LifetimeType get_lifetime_type () const { @@ -662,6 +665,8 @@ public: // Returns whether the lifetime param has any lifetime bounds. bool has_lifetime_bounds () const { return !lifetime_bounds.empty (); } + std::vector<Lifetime> &get_lifetime_bounds () { return lifetime_bounds; } + // Returns whether the lifetime param has an outer attribute. bool has_outer_attribute () const { return !outer_attr.is_empty (); }
reply other threads:[~2024-01-30 12:00 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240130120026.116C73858011@sourceware.org \ --to=cohenarthur@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).