public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] ast: Add get_kind() virtual function for GenericParam class
@ 2022-06-15  7:00 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-15  7:00 UTC (permalink / raw)
  To: gcc-cvs

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?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-15  7:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15  7:00 [gcc/devel/rust/master] ast: Add get_kind() virtual function for GenericParam 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).