pub struct FunctionType {
pub ret: TypeId,
pub params: Vec<TypeId>,
pub variadic: bool,
pub prototyped: bool,
pub convention: Convention,
}Expand description
A function type.
Fields§
§ret: TypeIdWhat it returns.
params: Vec<TypeId>The parameter types, after the adjustments a parameter declaration gets: an array parameter has already decayed to a pointer and a function parameter to a function pointer, because those adjustments are part of forming the type and not part of calling it.
variadic: boolWhether the list ends in ....
prototyped: boolWhether there was a prototype at all.
int f() declares an unprototyped function before C23 and a function taking no
arguments from C23 onwards, and the difference is visible in what calls are checked
and in what the composite type of a redeclaration is. The dialect decides which
meaning () gets, and this records the decision rather than repeating it.
convention: ConventionWhich calling convention a call to it and its own body use.
Part of the type because gcc makes it part of the type: a pointer to an ms_abi function
and a pointer to an ordinary one are pointers to different types on Linux, and a function
declared once each way has conflicting types. Convention::Target is the target’s own
whichever attribute named it, so ms_abi on Windows changes nothing about a type and
neither does sysv_abi anywhere else, and a type that never met an attribute is the same
type as one that met the attribute naming the target’s convention.