[gcc/devel/rust/master] Add a function to check if a function is variadic

Thomas Schwinge tschwinge@gcc.gnu.org
Tue May 7 15:58:41 GMT 2024


https://gcc.gnu.org/g:56d6246dbbbaf7566d31f94654c96dc5a4681e49

commit 56d6246dbbbaf7566d31f94654c96dc5a4681e49
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Wed Oct 18 15:04:58 2023 +0200

    Add a function to check if a function is variadic
    
    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>

Diff:
---
 gcc/rust/ast/rust-item.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index 74dd8c1d87af..c4653d95fb49 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -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


More information about the Gcc-cvs mailing list