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-7878] gccrs: nr2.0: Use DefaultResolver for TopLevel Date: Tue, 16 Jan 2024 18:03:48 +0000 (GMT) [thread overview] Message-ID: <20240116180348.8AA973857C4C@sourceware.org> (raw) https://gcc.gnu.org/g:3b0a200eb8c986f17c550b902d5f7ab832b716e2 commit r14-7878-g3b0a200eb8c986f17c550b902d5f7ab832b716e2 Author: Arthur Cohen <arthur.cohen@embecosm.com> Date: Thu Jul 20 15:15:21 2023 +0200 gccrs: nr2.0: Use DefaultResolver for TopLevel gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.h (class TopLevel): Inherit from DefaultResolver * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::TopLevel): Remove unecessary methods Diff: --- gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 4 +++- gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc index 73c857e3ba7..7923342b39a 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -23,7 +23,9 @@ namespace Rust { namespace Resolver2_0 { -TopLevel::TopLevel (NameResolutionContext &resolver) : ctx (resolver) {} +TopLevel::TopLevel (NameResolutionContext &resolver) + : DefaultResolver (resolver) +{} template <typename T> void diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h index db2033fc91c..93d40b8cb2b 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h @@ -21,7 +21,7 @@ #include "rust-ast-visitor.h" #include "rust-name-resolution-context.h" -#include "rust-ast-resolve-base.h" +#include "rust-default-resolver.h" namespace Rust { namespace Resolver2_0 { @@ -31,10 +31,9 @@ namespace Resolver2_0 { * crate, and inserting them into the proper namespaces. These definitions can * then be accessed by subsequent resolvers, such as `Early` or `Late`. */ -// TODO: Merge Resolver namespaces and use `public ResolverBase` -class TopLevel : public ::Rust::Resolver::ResolverBase +class TopLevel : public DefaultResolver { - using ::Rust::Resolver::ResolverBase::visit; + using DefaultResolver::visit; public: TopLevel (NameResolutionContext &resolver); @@ -42,9 +41,15 @@ public: void go (AST::Crate &crate); private: - NameResolutionContext &ctx; - - // FIXME: Documentation + /** + * Insert a new definition or error out if a definition with the same name was + * already present in the same namespace in the same scope. + * + * @param identifier The identifier of the definition to add. + * @param node A reference to the node, so we can get its `NodeId` and + * location. + * @param ns The namespace in which to add the definition. + */ template <typename T> void insert_or_error_out (const Identifier &identifier, const T &node, Namespace ns);
reply other threads:[~2024-01-16 18:03 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=20240116180348.8AA973857C4C@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).