pub struct FunctionDef {
pub specifiers: DeclSpecifiers,
pub name: Ident,
pub ty: Type,
pub kr_decls: Vec<Decl>,
pub attrs: Attributes,
pub asm_label: Option<Spanned<String>>,
pub body: Block,
pub uses_label_addrs: bool,
pub range: SourceRange,
}Expand description
A function definition.
Fields§
§specifiers: DeclSpecifiersThe declaration specifiers.
name: IdentThe function’s name.
ty: TypeThe function’s type; always TypeKind::Function unless recovery
kicked in.
kr_decls: Vec<Decl>Old-style parameter declarations (int f(a) int a; { … }). Empty for a
prototype-style definition; sema decides whether to accept them.
attrs: AttributesWhat __attribute__((…)) written after the declarator asked for.
asm_label: Option<Spanned<String>>The symbol __asm__("name") renamed the definition to.
body: BlockThe body.
uses_label_addrs: boolWhether the body takes the address of a label — GNU’s &&label.
Such a function is lowered through a control-flow
graph, where a computed goto is a switch over the
labels whose address is taken. The parser records it because &&label is an
expression and may sit anywhere one may — an initialiser, an
argument, a block-scope static’s table — while the rest of the
decision is read off the statements; see
Parser::label_addrs. A nested function’s own
&&label is its own business and does not set this.
range: SourceRangeWhere the definition was written.