]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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)
committerPhilip Herron <philip.herron@embecosm.com>
Thu, 9 Nov 2023 15:39:45 +0000 (15:39 +0000)
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 74dd8c1d87afd47d1f4e008d6747e8020e6720c1..c4653d95fb497e83ee0fa57ff02fc95b3e61ebe9 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