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] ast: Add get_kind() virtual function for GenericParam class
Date: Wed, 15 Jun 2022 07:00:47 +0000 (GMT)	[thread overview]
Message-ID: <20220615070047.F19A13856DEA@sourceware.org> (raw)

https://gcc.gnu.org/g:b9013bda082602ecdc6519009fe82c8f17d2cc4d

commit b9013bda082602ecdc6519009fe82c8f17d2cc4d
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Tue Jun 14 13:20:45 2022 +0200

    ast: Add get_kind() virtual function for GenericParam class

Diff:
---
 gcc/rust/ast/rust-ast.h  | 11 +++++++++++
 gcc/rust/ast/rust-item.h |  2 ++
 2 files changed, 13 insertions(+)

diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 8f5657f0960..2d7d31a34b7 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -1255,6 +1255,13 @@ protected:
 class GenericParam
 {
 public:
+  enum class Kind
+  {
+    Lifetime,
+    Type,
+    Const,
+  };
+
   virtual ~GenericParam () {}
 
   // Unique pointer custom clone function
@@ -1269,6 +1276,8 @@ public:
 
   virtual Location get_locus () const = 0;
 
+  virtual Kind get_kind () const = 0;
+
   NodeId get_node_id () { return node_id; }
 
 protected:
@@ -1322,6 +1331,8 @@ public:
 
   Location get_locus () const override final { return locus; }
 
+  Kind get_kind () const override final { return Kind::Lifetime; }
+
 protected:
   /* Use covariance to implement clone function as returning this object rather
    * than base */
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index 6d953fb128c..94ffffba6fa 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -132,6 +132,8 @@ public:
 
   Location get_locus () const override final { return locus; }
 
+  Kind get_kind () const override final { return Kind::Type; }
+
   void accept_vis (ASTVisitor &vis) override;
 
   // TODO: is this better? Or is a "vis_block" better?


                 reply	other threads:[~2022-06-15  7: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=20220615070047.F19A13856DEA@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: link
Be 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).