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/ › Builder.zig › addGlobalAssumeCapacity
addGlobalAssumeCapacity
Builder.addGlobalAssumeCapacity
pub fn addGlobalAssumeCapacity (self : *Builder , name : StrtabString , global : Global ) Global .Index
File
Code
pub fn addGlobalAssumeCapacity (self : *Builder , name : StrtabString , global : Global ) Global .Index {
_ = self .ptrTypeAssumeCapacity (global .addr_space );
var id = name ;
if (name == .empty ) {
id = self .next_unnamed_global ;
assert (id != self .next_replaced_global );
self .next_unnamed_global = @fromBackingInt (@intCast (@backingInt (id ) + 1 ));
}
while (true ) {
const global_gop = self .globals .getOrPutAssumeCapacity (id );
if (!global_gop .found_existing ) {
global_gop .value_ptr .* = global ;
const global_index : Global .Index = @fromBackingInt (@intCast (global_gop .index ));
global_index .updateDsoLocal (self );
return global_index ;
}
const unique_gop = self .next_unique_global_id .getOrPutAssumeCapacity (name );
if (!unique_gop .found_existing ) unique_gop .value_ptr .* = 2 ;
id = self .strtabStringFmtAssumeCapacity ("{s}.{d}" , .{ name .slice (self ).?, unique_gop .value_ptr .* });
unique_gop .value_ptr .* += 1 ;
}
}