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 › std/ › zig/ › llvm/ › BitcodeReader.zig › next
next
BitcodeReader.next
pub fn next (bc : *BitcodeReader ) !?Item
File
Code
pub fn next (bc : *BitcodeReader ) !?Item {
while (true ) {
const record = (try bc .nextRecord ()) orelse
return if (bc .stack .items .len > 1 ) error .EndOfStream else null ;
switch (record .id ) {
else => return .{ .record = record },
Abbrev .Builtin .end_block .toRecordId () => {
const block_id = bc .stack .items [bc .stack .items .len - 1 ].block_id .?;
try bc .endBlock ();
return .{ .end_block = .{
.name = if (bc .block_info .get (block_id )) |block_info |
block_info .block_name
else
&.{},
.id = block_id ,
.len = 0 ,
} };
},
Abbrev .Builtin .enter_subblock .toRecordId () => {
const block_id : u32 = @intCast (record .operands [0 ]);
switch (block_id ) {
Block .block_info => {
try bc .startBlock (Block .block_info , @intCast (record .operands [1 ]));
try bc .parseBlockInfoBlock ();
try bc .endBlock ();
},
Block .first_reserved ...Block .last_standard => return error .UnsupportedBlockId ,
else => {
try bc .startBlock (block_id , @intCast (record .operands [1 ]));
return .{ .start_block = .{
.name = if (bc .block_info .get (block_id )) |block_info |
block_info .block_name
else
&.{},
.id = block_id ,
.len = @intCast (record .operands [2 ]),
} };
},
}
},
Abbrev .Builtin .define_abbrev .toRecordId () => try bc .stack .items [bc .stack .items .len - 1 ]
.abbrevs .addOwnedAbbrev (bc .allocator , try record .toOwnedAbbrev (bc .allocator )),
}
}
}