Skip to content

Commit 74719ba

Browse files
committed
update callsites
1 parent 8bef653 commit 74719ba

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

lib/compiler/aro/aro/Preprocessor.zig

+4-3
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,14 @@ fn clearBuffers(pp: *Preprocessor) void {
270270

271271
pub fn expansionSlice(pp: *Preprocessor, tok: Tree.TokenIndex) []Source.Location {
272272
const S = struct {
273-
fn orderTokenIndex(context: Tree.TokenIndex, item: Tree.TokenIndex) std.math.Order {
274-
return std.math.order(context, item);
273+
fn order(probed: Tree.TokenIndex, context: Tree.TokenIndex) std.math.Order {
274+
return std.math.order(probed, context);
275275
}
276276
};
277277

278278
const indices = pp.expansion_entries.items(.idx);
279-
const idx = std.sort.binarySearch(Tree.TokenIndex, indices, tok, S.orderTokenIndex) orelse return &.{};
279+
const idx, const found = std.sort.binarySearch(Tree.TokenIndex, indices, tok, S.order);
280+
if (!found) return &.{};
280281
const locs = pp.expansion_entries.items(.locs)[idx];
281282
var i: usize = 0;
282283
while (locs[i].id != .unused) : (i += 1) {}

lib/std/debug/Coverage.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ pub fn resolveAddressesDwarf(
195195
const slc = &cu.src_loc_cache.?;
196196
const table_addrs = slc.line_table.keys();
197197
line_table_i = std.sort.upperBound(u64, table_addrs, pc, struct {
198-
fn order(context: u64, item: u64) std.math.Order {
199-
return std.math.order(context, item);
198+
fn order(probed: u64, context: u64) std.math.Order {
199+
return std.math.order(probed, context);
200200
}
201201
}.order);
202202
}

lib/std/debug/Dwarf.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ pub const CompileUnit = struct {
183183

184184
pub fn findSource(slc: *const SrcLocCache, address: u64) !LineEntry {
185185
const index = std.sort.upperBound(u64, slc.line_table.keys(), address, struct {
186-
fn order(context: u64, item: u64) std.math.Order {
187-
return std.math.order(context, item);
186+
fn order(probed: u64, context: u64) std.math.Order {
187+
return std.math.order(probed, context);
188188
}
189189
}.order);
190190
if (index == 0) return missing();

lib/std/debug/SelfInfo.zig

+11-10
Original file line numberDiff line numberDiff line change
@@ -1651,18 +1651,19 @@ pub fn unwindFrameDwarf(
16511651
break :blk .{ cie, fde };
16521652
}
16531653

1654-
const index = std.sort.binarySearch(Dwarf.FrameDescriptionEntry, di.fde_list.items, context.pc, struct {
1655-
pub fn compareFn(pc: usize, item: Dwarf.FrameDescriptionEntry) std.math.Order {
1656-
if (pc < item.pc_begin) return .lt;
1657-
1658-
const range_end = item.pc_begin + item.pc_range;
1659-
if (pc < range_end) return .eq;
1660-
1661-
return .gt;
1654+
const index, const found = std.sort.binarySearch(Dwarf.FrameDescriptionEntry, di.fde_list.items, context.pc, struct {
1655+
pub fn order(probed: Dwarf.FrameDescriptionEntry, pc: usize) std.math.Order {
1656+
return if (probed.pc_begin > pc) // start of range too great
1657+
.gt
1658+
else if (probed.pc_begin + probed.pc_range > pc) // target within range
1659+
.eq
1660+
else // end of range too little
1661+
.lt;
16621662
}
1663-
}.compareFn);
1663+
}.order);
16641664

1665-
const fde = if (index) |i| di.fde_list.items[i] else return error.MissingFDE;
1665+
if (!found) return error.MissingFDE;
1666+
const fde = di.fde_list.items[index];
16661667
const cie = di.cie_map.get(fde.cie_length_offset) orelse return error.MissingCIE;
16671668

16681669
break :blk .{ cie, fde };

0 commit comments

Comments
 (0)