Skip to content

Commit

Permalink
Add a function to check if a function is variadic
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
P-E-P committed Oct 18, 2023
1 parent f559edb commit e675b5e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gcc/rust/ast/rust-item.h
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,12 @@ class Function : public VisItem, public InherentImplItem, public TraitImplItem

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
Expand Down

0 comments on commit e675b5e

Please sign in to comment.