pub const DeclContents = struct pub fn clear(contents: *DeclContents) voidpub fn deinit(contents: *DeclContents, gpa: Allocator) void4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058pub 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,
type_decls: std.ArrayList(Inst.Index),
other: std.ArrayList(Inst.Index),
pub const init: DeclContents = .{
.func_decl = null,
.type_decls = .empty,
.other = .empty,
};
pub fn clear(contents: *DeclContents) void {
contents.func_decl = null;
contents.type_decls.clearRetainingCapacity();
contents.other.clearRetainingCapacity();
}
pub fn deinit(contents: *DeclContents, gpa: Allocator) void {
contents.type_decls.deinit(gpa);
contents.other.deinit(gpa);
}
}
DeclContentscontains all "interesting" instructions found within a declaration byfindTrackable. These instructions are partitioned into a few different sets, since this makes ZIR instruction mapping more effective.