]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add a function to check if a function is variadic
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 18 Oct 2023 13:04:58 +0000 (15:04 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:13:12 +0000 (19:13 +0100)
This function provides an easy way to check for a function's varidicity.

gcc/rust/ChangeLog:

* ast/rust-item.h: Add a getter to check if a given function is
variadic.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ast/rust-item.h

index 38d8b53a43ca4606262afb27953df1d0d2a1760e..109680a1d78d7fa131f731f72f95e095c23c8e9f 100644 (file)
@@ -1682,6 +1682,12 @@ public:
 
   void accept_vis (ASTVisitor &vis) override;
 
+  bool is_variadic () const
+  {
+    return function_params.size () != 0
+          && function_params.back ().is_variadic ();
+  }
+
   // Invalid if block is null, so base stripping on that.
   void mark_for_strip () override { function_body = nullptr; }
   bool is_marked_for_strip () const override