public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] hir: Keep BaseKind enum inside the Node class Date: Wed, 8 Jun 2022 12:29:30 +0000 (GMT) [thread overview] Message-ID: <20220608122930.08BC0386DC69@sourceware.org> (raw) https://gcc.gnu.org/g:a376e1939e5ced1fc457d6a35c64c5f75d3da976 commit a376e1939e5ced1fc457d6a35c64c5f75d3da976 Author: Arthur Cohen <arthur.cohen@embecosm.com> Date: Fri Apr 8 11:43:50 2022 +0200 hir: Keep BaseKind enum inside the Node class Co-authored-by: philberty <philip.herron@embecosm.com> Diff: --- gcc/rust/hir/tree/rust-hir.h | 48 +++++++++++++++++----------------- gcc/rust/privacy/rust-privacy-check.cc | 2 +- gcc/rust/privacy/rust-privacy-ctx.cc | 1 + gcc/rust/privacy/rust-reachability.cc | 2 +- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/gcc/rust/hir/tree/rust-hir.h b/gcc/rust/hir/tree/rust-hir.h index e2c930e1374..67cfb3ae423 100644 --- a/gcc/rust/hir/tree/rust-hir.h +++ b/gcc/rust/hir/tree/rust-hir.h @@ -45,33 +45,33 @@ class HIRTypeVisitor; // forward decl for use in token tree method class Token; -// Kind for downcasting various HIR nodes to other base classes when visiting -// them -enum BaseKind -{ - /* class ExternalItem */ - EXTERNAL, - /* class TraitItem */ - TRAIT_ITEM, - /* class VisItem */ - VIS_ITEM, - /* class Item */ - ITEM, - /* class ImplItem */ - IMPL, - /* class Type */ - TYPE, - /* class Stmt */ - STMT, - /* class Expr */ - EXPR, - /* class Pattern */ - PATTERN, -}; - class Node { public: + // Kind for downcasting various HIR nodes to other base classes when visiting + // them + enum BaseKind + { + /* class ExternalItem */ + EXTERNAL, + /* class TraitItem */ + TRAIT_ITEM, + /* class VisItem */ + VIS_ITEM, + /* class Item */ + ITEM, + /* class ImplItem */ + IMPL, + /* class Type */ + TYPE, + /* class Stmt */ + STMT, + /* class Expr */ + EXPR, + /* class Pattern */ + PATTERN, + }; + /** * Get the kind of HIR node we are dealing with. This is useful for * downcasting to more precise types when necessary, i.e going from an `Item*` diff --git a/gcc/rust/privacy/rust-privacy-check.cc b/gcc/rust/privacy/rust-privacy-check.cc index cbacb6d90a9..d52d8e1a64f 100644 --- a/gcc/rust/privacy/rust-privacy-check.cc +++ b/gcc/rust/privacy/rust-privacy-check.cc @@ -33,7 +33,7 @@ Resolver::resolve (HIR::Crate &crate) const auto &items = crate.items; for (auto &item : items) { - if (item->get_hir_kind () == HIR::VIS_ITEM) + if (item->get_hir_kind () == HIR::Node::VIS_ITEM) { auto vis_item = static_cast<HIR::VisItem *> (item.get ()); vis_item->accept_vis (visitor); diff --git a/gcc/rust/privacy/rust-privacy-ctx.cc b/gcc/rust/privacy/rust-privacy-ctx.cc index 3a44ce0cc0e..629944a390c 100644 --- a/gcc/rust/privacy/rust-privacy-ctx.cc +++ b/gcc/rust/privacy/rust-privacy-ctx.cc @@ -21,6 +21,7 @@ namespace Rust { namespace Privacy { + static ReachLevel insert_if_higher (ReachLevel new_level, std::unordered_map<HirId, ReachLevel>::iterator &existing) diff --git a/gcc/rust/privacy/rust-reachability.cc b/gcc/rust/privacy/rust-reachability.cc index ade026f20da..e76ba714c6d 100644 --- a/gcc/rust/privacy/rust-reachability.cc +++ b/gcc/rust/privacy/rust-reachability.cc @@ -24,7 +24,7 @@ namespace Privacy { static HIR::VisItem * maybe_get_vis_item (std::unique_ptr<HIR::Item> &item) { - if (item->get_hir_kind () != HIR::VIS_ITEM) + if (item->get_hir_kind () != HIR::Node::VIS_ITEM) return nullptr; return static_cast<HIR::VisItem *> (item.get ());
reply other threads:[~2022-06-08 12:29 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=20220608122930.08BC0386DC69@sourceware.org \ --to=tschwinge@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).