Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

getInlineeSourceLines

Public Function
std.debug.Pdb.getInlineeSourceLines
pub fn getInlineeSourceLines(self: *Pdb, mod: *Module, inlinee: u32) InlineeSourceLocationIterator

Returns all pdb.InlineeSourceLines for a given module with the given inlinee. Ideally there would only be one entry per inlinee, but LLVM appears to assign all functions that share a name the same inlinee ID. This is a bug: https://github.com/llvm/llvm-project/issues/191787 The best the caller can do right now is print all the results.

Params

File

debug/Pdb.zig:718
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
pub fn getInlineeSourceLines(self: *Pdb, mod: *Module, inlinee: u32) InlineeSourceLocationIterator {
    _ = self;

    // Binary search to an arbitrary match, if there are other matches they will be adjacent
    const any = std.sort.binarySearch(
        *align(1) const pdb.InlineeSourceLine,
        mod.inlinee_source_lines,
        inlinee,
        compareInlineeSourceLineInlinee,
    ) orelse return .empty;

    // Linearly scan to the first match
    const begin = b: {
        var begin = any;
        while (begin > 0) {
            const prev = begin - 1;
            if (mod.inlinee_source_lines[prev].inlinee != inlinee) break;
            begin = prev;
        }
        break :b begin;
    };

    // Linearly scan to the last match
    const end = b: {
        var end = any + 1;
        while (end < mod.inlinee_source_lines.len and
            mod.inlinee_source_lines[end].inlinee == inlinee) : (end += 1)
        {}
        break :b end;
    };

    // Return an iterator over all matches (the iterator filters out duplicate entries)
    return .{ .lines = mod.inlinee_source_lines[begin..end] };
}