的一个定义FunctionType *FunctionType::get是:
FunctionType *FunctionType::get(Type *Result, bool isVarArg)
文档说:
创建一个
FunctionType不带参数的。
如果类型没有参数,我们什么时候使用bool isVarArg参数来表示参数的数量是可变的?
的一个定义FunctionType *FunctionType::get是:
FunctionType *FunctionType::get(Type *Result, bool isVarArg)
文档说:
创建一个
FunctionType不带参数的。
如果类型没有参数,我们什么时候使用bool isVarArg参数来表示参数的数量是可变的?
原因是 LLVM 对可变参数的处理方式与固定/位置参数不同。没有固定参数(出现在 中的那种ArrayRef<Type *> llvm::FunctionType::params () const)是文档中“无参数”的意思,因此 varargs 是豁免的。
如果您检查注释getNumParams(),它会显示:
返回此函数类型所需的固定参数的数量。这不考虑可变参数。