Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › compiler/ › aro/ › backend/ › Ir.zig › Renderer
Renderer
Ir.Renderer
pub const Renderer = struct
File
Code
pub const Renderer = struct {
gpa : Allocator ,
obj : *Object ,
ir : *const Ir ,
errors : ErrorList = .{},
pub const ErrorList = std .array_hash_map .String ([]const u8 );
pub const Error = Allocator .Error || error {LowerFail };
pub fn deinit (r : *Renderer ) void {
for (r .errors .values ()) |msg | r .gpa .free (msg );
r .errors .deinit (r .gpa );
}
pub fn render (r : *Renderer ) !void {
switch (r .obj .target .cpu .arch ) {
.x86 , .x86_64 => return @import ("Ir/x86/Renderer.zig" ).render (r ),
else => unreachable ,
}
}
pub fn fail (
r : *Renderer ,
name : []const u8 ,
comptime format : []const u8 ,
args : anytype ,
) Error {
try r .errors .ensureUnusedCapacity (r .gpa , 1 );
r .errors .putAssumeCapacity (name , try std .fmt .allocPrint (r .gpa , format , args ));
return error .LowerFail ;
}
}