public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] hir: Keep BaseKind enum inside the Node class
@ 2022-06-08 12:29 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:29 UTC (permalink / raw)
To: gcc-cvs
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 ());
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:29 [gcc/devel/rust/master] hir: Keep BaseKind enum inside the Node class Thomas Schwinge
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).