diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-08-28 18:25:14 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-08-29 23:43:52 +0100 |
| commit | c62487da76b08a0dfb69fbf76501250ca065c140 (patch) | |
| tree | 1ef46d45f3ff9edaade3805d9ab5a9910cb8571b /src/codegen/llvm/BitcodeReader.zig | |
| parent | ba8d3f69ca65738f27deea43e795f5e787a061f2 (diff) | |
| download | zig-c62487da76b08a0dfb69fbf76501250ca065c140.tar.gz zig-c62487da76b08a0dfb69fbf76501250ca065c140.zip | |
compiler: avoid field/decl name conflicts
Most of the required renames here are net wins for readaibility, I'd
say. The ones in `arch` are a little more verbose, but I think better. I
didn't bother renaming the non-conflicting functions in
`arch/arm/bits.zig` and `arch/aarch64/bits.zig`, since these backends
are pretty bit-rotted anyway AIUI.
Diffstat (limited to 'src/codegen/llvm/BitcodeReader.zig')
| -rw-r--r-- | src/codegen/llvm/BitcodeReader.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/codegen/llvm/BitcodeReader.zig b/src/codegen/llvm/BitcodeReader.zig index 940b965340..8a9af15629 100644 --- a/src/codegen/llvm/BitcodeReader.zig +++ b/src/codegen/llvm/BitcodeReader.zig @@ -33,9 +33,9 @@ pub const Block = struct { .abbrevs = .{ .abbrevs = .{} }, }; - const set_bid: u32 = 1; - const block_name: u32 = 2; - const set_record_name: u32 = 3; + const set_bid_id: u32 = 1; + const block_name_id: u32 = 2; + const set_record_name_id: u32 = 3; fn deinit(info: *Info, allocator: std.mem.Allocator) void { allocator.free(info.block_name); @@ -61,7 +61,7 @@ pub const Record = struct { assert(record.id == Abbrev.Builtin.define_abbrev.toRecordId()); var i: usize = 0; while (i < record.operands.len) switch (record.operands[i]) { - Abbrev.Operand.literal => { + Abbrev.Operand.literal_id => { try operands.append(.{ .literal = record.operands[i + 1] }); i += 2; }, @@ -211,7 +211,7 @@ fn nextRecord(bc: *BitcodeReader) !?Record { .align_32_bits, .block_len => return error.UnsupportedArrayElement, .abbrev_op => switch (try bc.readFixed(u1, 1)) { 1 => try operands.appendSlice(&.{ - Abbrev.Operand.literal, + Abbrev.Operand.literal_id, try bc.readVbr(u64, 8), }), 0 => { @@ -334,9 +334,9 @@ fn parseBlockInfoBlock(bc: *BitcodeReader) !void { try record.toOwnedAbbrev(bc.allocator), ); }, - Block.Info.set_bid => block_id = std.math.cast(u32, record.operands[0]) orelse + Block.Info.set_bid_id => block_id = std.math.cast(u32, record.operands[0]) orelse return error.Overflow, - Block.Info.block_name => if (bc.keep_names) { + Block.Info.block_name_id => if (bc.keep_names) { const gop = try bc.block_info.getOrPut(bc.allocator, block_id orelse return error.UnspecifiedBlockId); if (!gop.found_existing) gop.value_ptr.* = Block.Info.default; @@ -346,7 +346,7 @@ fn parseBlockInfoBlock(bc: *BitcodeReader) !void { byte.* = std.math.cast(u8, operand) orelse return error.InvalidName; gop.value_ptr.block_name = name; }, - Block.Info.set_record_name => if (bc.keep_names) { + Block.Info.set_record_name_id => if (bc.keep_names) { const gop = try bc.block_info.getOrPut(bc.allocator, block_id orelse return error.UnspecifiedBlockId); if (!gop.found_existing) gop.value_ptr.* = Block.Info.default; @@ -467,7 +467,7 @@ const Abbrev = struct { block_len, abbrev_op, - const literal = std.math.maxInt(u64); + const literal_id = std.math.maxInt(u64); const Encoding = enum(u3) { fixed = 1, vbr = 2, |
