From 41f480d16d3c6cc1e901d2ae3fcd4a9b5706aa51 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Wed, 18 Oct 2023 15:04:58 +0200 Subject: [PATCH] gccrs: 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 --- 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 38d8b53a43ca..109680a1d78d 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 -- 2.47.2