DeclContents contains all "interesting" instructions found within a declaration by findTrackable.
These instructions are partitioned into a few different sets, since this makes ZIR instruction mapping
more effective.
func_decl: ?Inst.IndexThis is a simple optional because ZIR guarantees that a func/func_inferred/func_fancy instruction
can only occur once per declaration.
explicit_types: std.ArrayListUnmanaged(Inst.Index)other: std.ArrayListUnmanaged(Inst.Index)pub const init: DeclContents = .{
.func_decl = null,
.explicit_types = .empty,
.other = .empty,
}pub fn clear(contents: *DeclContents) voidcontents: *DeclContentspub fn clear(contents: *DeclContents) void {
contents.func_decl = null;
contents.explicit_types.clearRetainingCapacity();
contents.other.clearRetainingCapacity();
}pub fn deinit(contents: *DeclContents, gpa: Allocator) voidcontents: *DeclContentsgpa: Allocatorpub fn deinit(contents: *DeclContents, gpa: Allocator) void {
contents.explicit_types.deinit(gpa);
contents.other.deinit(gpa);
}pub const DeclContents = struct {
/// This is a simple optional because ZIR guarantees that a `func`/`func_inferred`/`func_fancy` instruction
/// can only occur once per `declaration`.
func_decl: ?Inst.Index,
explicit_types: std.ArrayListUnmanaged(Inst.Index),
other: std.ArrayListUnmanaged(Inst.Index),
pub const init: DeclContents = .{
.func_decl = null,
.explicit_types = .empty,
.other = .empty,
};
pub fn clear(contents: *DeclContents) void {
contents.func_decl = null;
contents.explicit_types.clearRetainingCapacity();
contents.other.clearRetainingCapacity();
}
pub fn deinit(contents: *DeclContents, gpa: Allocator) void {
contents.explicit_types.deinit(gpa);
contents.other.deinit(gpa);
}
}