One definition of FunctionType *FunctionType::get
is:
FunctionType *FunctionType::get(Type *Result, bool isVarArg)
The documentation says:
Create a
FunctionType
taking no parameters.
When are we going to use the bool isVarArg
parameter to indicate that the number of arguments is variable if the type has no parameters?
The reason for this is that variable arguments are treated differently by LLVM than fixed/positional parameters. No fixed parameters (the kind that would appear in ArrayRef<Type *> llvm::FunctionType::params () const
) are what the docs mean by "no parameters", so varargs are exempt.
If you check the note for getNumParams()
, it says:
Return the number of fixed parameters this function type requires. This does not consider varargs.