| author | |
| committer | |
| log | b35589343894791a48b1423aa6d4a59b4858dfdb |
| tree | 62fb0542c4e49dd8748294bcfb75cf0c12fa5e23 |
| parent | 172c2797bdd5f939e53acc26ea6820896e62733a |
| signature | Commit is signed but in an unrecognized format. |
47 files changed, 210 insertions(+), 202 deletions(-)
src/Air.zig+1-1| ... | ... | @@ -1787,7 +1787,7 @@ pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool { |
| 1787 | 1787 | => false, |
| 1788 | 1788 | |
| 1789 | 1789 | .assembly => { |
| 1790 | var extra = air.extraData(Air.Asm, data.ty_pl.payload); | |
| 1790 | const extra = air.extraData(Air.Asm, data.ty_pl.payload); | |
| 1791 | 1791 | const is_volatile = @as(u1, @truncate(extra.data.flags >> 31)) != 0; |
| 1792 | 1792 | return is_volatile or if (extra.data.outputs_len == 1) |
| 1793 | 1793 | @as(Air.Inst.Ref, @enumFromInt(air.extra[extra.end])) != .none |
src/AstGen.zig+2-2| ... | ... | @@ -6707,7 +6707,7 @@ fn forExpr( |
| 6707 | 6707 | }; |
| 6708 | 6708 | } |
| 6709 | 6709 | |
| 6710 | var then_node = for_full.ast.then_expr; | |
| 6710 | const then_node = for_full.ast.then_expr; | |
| 6711 | 6711 | var then_scope = parent_gz.makeSubBlock(&cond_scope.base); |
| 6712 | 6712 | defer then_scope.unstack(); |
| 6713 | 6713 | |
| ... | ... | @@ -8160,7 +8160,7 @@ fn typeOf( |
| 8160 | 8160 | } |
| 8161 | 8161 | const payload_size: u32 = std.meta.fields(Zir.Inst.TypeOfPeer).len; |
| 8162 | 8162 | const payload_index = try reserveExtra(astgen, payload_size + args.len); |
| 8163 | var args_index = payload_index + payload_size; | |
| 8163 | const args_index = payload_index + payload_size; | |
| 8164 | 8164 | |
| 8165 | 8165 | const typeof_inst = try gz.addExtendedMultiOpPayloadIndex(.typeof_peer, payload_index, args.len); |
| 8166 | 8166 |
src/Autodoc.zig+50-50| ... | ... | @@ -985,7 +985,7 @@ fn walkInstruction( |
| 985 | 985 | }, |
| 986 | 986 | .import => { |
| 987 | 987 | const str_tok = data[@intFromEnum(inst)].str_tok; |
| 988 | var path = str_tok.get(file.zir); | |
| 988 | const path = str_tok.get(file.zir); | |
| 989 | 989 | |
| 990 | 990 | // importFile cannot error out since all files |
| 991 | 991 | // are already loaded at this point |
| ... | ... | @@ -1210,7 +1210,7 @@ fn walkInstruction( |
| 1210 | 1210 | .compile_error => { |
| 1211 | 1211 | const un_node = data[@intFromEnum(inst)].un_node; |
| 1212 | 1212 | |
| 1213 | var operand: DocData.WalkResult = try self.walkRef( | |
| 1213 | const operand: DocData.WalkResult = try self.walkRef( | |
| 1214 | 1214 | file, |
| 1215 | 1215 | parent_scope, |
| 1216 | 1216 | parent_src, |
| ... | ... | @@ -1252,7 +1252,7 @@ fn walkInstruction( |
| 1252 | 1252 | const byte_count = str.len * @sizeOf(std.math.big.Limb); |
| 1253 | 1253 | const limb_bytes = file.zir.string_bytes[str.start..][0..byte_count]; |
| 1254 | 1254 | |
| 1255 | var limbs = try self.arena.alloc(std.math.big.Limb, str.len); | |
| 1255 | const limbs = try self.arena.alloc(std.math.big.Limb, str.len); | |
| 1256 | 1256 | @memcpy(std.mem.sliceAsBytes(limbs)[0..limb_bytes.len], limb_bytes); |
| 1257 | 1257 | |
| 1258 | 1258 | const big_int = std.math.big.int.Const{ |
| ... | ... | @@ -1281,7 +1281,7 @@ fn walkInstruction( |
| 1281 | 1281 | const slice_index = self.exprs.items.len; |
| 1282 | 1282 | try self.exprs.append(self.arena, .{ .slice = .{ .lhs = 0, .start = 0 } }); |
| 1283 | 1283 | |
| 1284 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 1284 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 1285 | 1285 | file, |
| 1286 | 1286 | parent_scope, |
| 1287 | 1287 | parent_src, |
| ... | ... | @@ -1289,7 +1289,7 @@ fn walkInstruction( |
| 1289 | 1289 | false, |
| 1290 | 1290 | call_ctx, |
| 1291 | 1291 | ); |
| 1292 | var start: DocData.WalkResult = try self.walkRef( | |
| 1292 | const start: DocData.WalkResult = try self.walkRef( | |
| 1293 | 1293 | file, |
| 1294 | 1294 | parent_scope, |
| 1295 | 1295 | parent_src, |
| ... | ... | @@ -1321,7 +1321,7 @@ fn walkInstruction( |
| 1321 | 1321 | const slice_index = self.exprs.items.len; |
| 1322 | 1322 | try self.exprs.append(self.arena, .{ .slice = .{ .lhs = 0, .start = 0 } }); |
| 1323 | 1323 | |
| 1324 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 1324 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 1325 | 1325 | file, |
| 1326 | 1326 | parent_scope, |
| 1327 | 1327 | parent_src, |
| ... | ... | @@ -1329,7 +1329,7 @@ fn walkInstruction( |
| 1329 | 1329 | false, |
| 1330 | 1330 | call_ctx, |
| 1331 | 1331 | ); |
| 1332 | var start: DocData.WalkResult = try self.walkRef( | |
| 1332 | const start: DocData.WalkResult = try self.walkRef( | |
| 1333 | 1333 | file, |
| 1334 | 1334 | parent_scope, |
| 1335 | 1335 | parent_src, |
| ... | ... | @@ -1337,7 +1337,7 @@ fn walkInstruction( |
| 1337 | 1337 | false, |
| 1338 | 1338 | call_ctx, |
| 1339 | 1339 | ); |
| 1340 | var end: DocData.WalkResult = try self.walkRef( | |
| 1340 | const end: DocData.WalkResult = try self.walkRef( | |
| 1341 | 1341 | file, |
| 1342 | 1342 | parent_scope, |
| 1343 | 1343 | parent_src, |
| ... | ... | @@ -1371,7 +1371,7 @@ fn walkInstruction( |
| 1371 | 1371 | const slice_index = self.exprs.items.len; |
| 1372 | 1372 | try self.exprs.append(self.arena, .{ .slice = .{ .lhs = 0, .start = 0 } }); |
| 1373 | 1373 | |
| 1374 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 1374 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 1375 | 1375 | file, |
| 1376 | 1376 | parent_scope, |
| 1377 | 1377 | parent_src, |
| ... | ... | @@ -1379,7 +1379,7 @@ fn walkInstruction( |
| 1379 | 1379 | false, |
| 1380 | 1380 | call_ctx, |
| 1381 | 1381 | ); |
| 1382 | var start: DocData.WalkResult = try self.walkRef( | |
| 1382 | const start: DocData.WalkResult = try self.walkRef( | |
| 1383 | 1383 | file, |
| 1384 | 1384 | parent_scope, |
| 1385 | 1385 | parent_src, |
| ... | ... | @@ -1387,7 +1387,7 @@ fn walkInstruction( |
| 1387 | 1387 | false, |
| 1388 | 1388 | call_ctx, |
| 1389 | 1389 | ); |
| 1390 | var end: DocData.WalkResult = try self.walkRef( | |
| 1390 | const end: DocData.WalkResult = try self.walkRef( | |
| 1391 | 1391 | file, |
| 1392 | 1392 | parent_scope, |
| 1393 | 1393 | parent_src, |
| ... | ... | @@ -1395,7 +1395,7 @@ fn walkInstruction( |
| 1395 | 1395 | false, |
| 1396 | 1396 | call_ctx, |
| 1397 | 1397 | ); |
| 1398 | var sentinel: DocData.WalkResult = try self.walkRef( | |
| 1398 | const sentinel: DocData.WalkResult = try self.walkRef( | |
| 1399 | 1399 | file, |
| 1400 | 1400 | parent_scope, |
| 1401 | 1401 | parent_src, |
| ... | ... | @@ -1436,7 +1436,7 @@ fn walkInstruction( |
| 1436 | 1436 | const slice_index = self.exprs.items.len; |
| 1437 | 1437 | try self.exprs.append(self.arena, .{ .slice = .{ .lhs = 0, .start = 0 } }); |
| 1438 | 1438 | |
| 1439 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 1439 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 1440 | 1440 | file, |
| 1441 | 1441 | parent_scope, |
| 1442 | 1442 | parent_src, |
| ... | ... | @@ -1444,7 +1444,7 @@ fn walkInstruction( |
| 1444 | 1444 | false, |
| 1445 | 1445 | call_ctx, |
| 1446 | 1446 | ); |
| 1447 | var start: DocData.WalkResult = try self.walkRef( | |
| 1447 | const start: DocData.WalkResult = try self.walkRef( | |
| 1448 | 1448 | file, |
| 1449 | 1449 | parent_scope, |
| 1450 | 1450 | parent_src, |
| ... | ... | @@ -1452,7 +1452,7 @@ fn walkInstruction( |
| 1452 | 1452 | false, |
| 1453 | 1453 | call_ctx, |
| 1454 | 1454 | ); |
| 1455 | var len: DocData.WalkResult = try self.walkRef( | |
| 1455 | const len: DocData.WalkResult = try self.walkRef( | |
| 1456 | 1456 | file, |
| 1457 | 1457 | parent_scope, |
| 1458 | 1458 | parent_src, |
| ... | ... | @@ -1460,7 +1460,7 @@ fn walkInstruction( |
| 1460 | 1460 | false, |
| 1461 | 1461 | call_ctx, |
| 1462 | 1462 | ); |
| 1463 | var sentinel_opt: ?DocData.WalkResult = if (extra.data.sentinel != .none) | |
| 1463 | const sentinel_opt: ?DocData.WalkResult = if (extra.data.sentinel != .none) | |
| 1464 | 1464 | try self.walkRef( |
| 1465 | 1465 | file, |
| 1466 | 1466 | parent_scope, |
| ... | ... | @@ -1574,7 +1574,7 @@ fn walkInstruction( |
| 1574 | 1574 | const binop_index = self.exprs.items.len; |
| 1575 | 1575 | try self.exprs.append(self.arena, .{ .binOp = .{ .lhs = 0, .rhs = 0 } }); |
| 1576 | 1576 | |
| 1577 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 1577 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 1578 | 1578 | file, |
| 1579 | 1579 | parent_scope, |
| 1580 | 1580 | parent_src, |
| ... | ... | @@ -1582,7 +1582,7 @@ fn walkInstruction( |
| 1582 | 1582 | false, |
| 1583 | 1583 | call_ctx, |
| 1584 | 1584 | ); |
| 1585 | var rhs: DocData.WalkResult = try self.walkRef( | |
| 1585 | const rhs: DocData.WalkResult = try self.walkRef( | |
| 1586 | 1586 | file, |
| 1587 | 1587 | parent_scope, |
| 1588 | 1588 | parent_src, |
| ... | ... | @@ -1620,7 +1620,7 @@ fn walkInstruction( |
| 1620 | 1620 | const binop_index = self.exprs.items.len; |
| 1621 | 1621 | try self.exprs.append(self.arena, .{ .binOp = .{ .lhs = 0, .rhs = 0 } }); |
| 1622 | 1622 | |
| 1623 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 1623 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 1624 | 1624 | file, |
| 1625 | 1625 | parent_scope, |
| 1626 | 1626 | parent_src, |
| ... | ... | @@ -1628,7 +1628,7 @@ fn walkInstruction( |
| 1628 | 1628 | false, |
| 1629 | 1629 | call_ctx, |
| 1630 | 1630 | ); |
| 1631 | var rhs: DocData.WalkResult = try self.walkRef( | |
| 1631 | const rhs: DocData.WalkResult = try self.walkRef( | |
| 1632 | 1632 | file, |
| 1633 | 1633 | parent_scope, |
| 1634 | 1634 | parent_src, |
| ... | ... | @@ -1786,7 +1786,7 @@ fn walkInstruction( |
| 1786 | 1786 | const pl_node = data[@intFromEnum(inst)].pl_node; |
| 1787 | 1787 | const extra = file.zir.extraData(Zir.Inst.Bin, pl_node.payload_index); |
| 1788 | 1788 | |
| 1789 | var rhs: DocData.WalkResult = try self.walkRef( | |
| 1789 | const rhs: DocData.WalkResult = try self.walkRef( | |
| 1790 | 1790 | file, |
| 1791 | 1791 | parent_scope, |
| 1792 | 1792 | parent_src, |
| ... | ... | @@ -1801,7 +1801,7 @@ fn walkInstruction( |
| 1801 | 1801 | const rhs_index = self.exprs.items.len; |
| 1802 | 1802 | try self.exprs.append(self.arena, rhs.expr); |
| 1803 | 1803 | |
| 1804 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 1804 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 1805 | 1805 | file, |
| 1806 | 1806 | parent_scope, |
| 1807 | 1807 | parent_src, |
| ... | ... | @@ -1850,7 +1850,7 @@ fn walkInstruction( |
| 1850 | 1850 | const binop_index = self.exprs.items.len; |
| 1851 | 1851 | try self.exprs.append(self.arena, .{ .builtinBin = .{ .lhs = 0, .rhs = 0 } }); |
| 1852 | 1852 | |
| 1853 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 1853 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 1854 | 1854 | file, |
| 1855 | 1855 | parent_scope, |
| 1856 | 1856 | parent_src, |
| ... | ... | @@ -1858,7 +1858,7 @@ fn walkInstruction( |
| 1858 | 1858 | false, |
| 1859 | 1859 | call_ctx, |
| 1860 | 1860 | ); |
| 1861 | var rhs: DocData.WalkResult = try self.walkRef( | |
| 1861 | const rhs: DocData.WalkResult = try self.walkRef( | |
| 1862 | 1862 | file, |
| 1863 | 1863 | parent_scope, |
| 1864 | 1864 | parent_src, |
| ... | ... | @@ -1882,7 +1882,7 @@ fn walkInstruction( |
| 1882 | 1882 | const pl_node = data[@intFromEnum(inst)].pl_node; |
| 1883 | 1883 | const extra = file.zir.extraData(Zir.Inst.MulAdd, pl_node.payload_index); |
| 1884 | 1884 | |
| 1885 | var mul1: DocData.WalkResult = try self.walkRef( | |
| 1885 | const mul1: DocData.WalkResult = try self.walkRef( | |
| 1886 | 1886 | file, |
| 1887 | 1887 | parent_scope, |
| 1888 | 1888 | parent_src, |
| ... | ... | @@ -1890,7 +1890,7 @@ fn walkInstruction( |
| 1890 | 1890 | false, |
| 1891 | 1891 | call_ctx, |
| 1892 | 1892 | ); |
| 1893 | var mul2: DocData.WalkResult = try self.walkRef( | |
| 1893 | const mul2: DocData.WalkResult = try self.walkRef( | |
| 1894 | 1894 | file, |
| 1895 | 1895 | parent_scope, |
| 1896 | 1896 | parent_src, |
| ... | ... | @@ -1898,7 +1898,7 @@ fn walkInstruction( |
| 1898 | 1898 | false, |
| 1899 | 1899 | call_ctx, |
| 1900 | 1900 | ); |
| 1901 | var add: DocData.WalkResult = try self.walkRef( | |
| 1901 | const add: DocData.WalkResult = try self.walkRef( | |
| 1902 | 1902 | file, |
| 1903 | 1903 | parent_scope, |
| 1904 | 1904 | parent_src, |
| ... | ... | @@ -1914,7 +1914,7 @@ fn walkInstruction( |
| 1914 | 1914 | const add_index = self.exprs.items.len; |
| 1915 | 1915 | try self.exprs.append(self.arena, add.expr); |
| 1916 | 1916 | |
| 1917 | var type_index: usize = self.exprs.items.len; | |
| 1917 | const type_index: usize = self.exprs.items.len; | |
| 1918 | 1918 | try self.exprs.append(self.arena, add.typeRef orelse .{ .type = @intFromEnum(Ref.type_type) }); |
| 1919 | 1919 | |
| 1920 | 1920 | return DocData.WalkResult{ |
| ... | ... | @@ -1933,7 +1933,7 @@ fn walkInstruction( |
| 1933 | 1933 | const pl_node = data[@intFromEnum(inst)].pl_node; |
| 1934 | 1934 | const extra = file.zir.extraData(Zir.Inst.UnionInit, pl_node.payload_index); |
| 1935 | 1935 | |
| 1936 | var union_type: DocData.WalkResult = try self.walkRef( | |
| 1936 | const union_type: DocData.WalkResult = try self.walkRef( | |
| 1937 | 1937 | file, |
| 1938 | 1938 | parent_scope, |
| 1939 | 1939 | parent_src, |
| ... | ... | @@ -1941,7 +1941,7 @@ fn walkInstruction( |
| 1941 | 1941 | false, |
| 1942 | 1942 | call_ctx, |
| 1943 | 1943 | ); |
| 1944 | var field_name: DocData.WalkResult = try self.walkRef( | |
| 1944 | const field_name: DocData.WalkResult = try self.walkRef( | |
| 1945 | 1945 | file, |
| 1946 | 1946 | parent_scope, |
| 1947 | 1947 | parent_src, |
| ... | ... | @@ -1949,7 +1949,7 @@ fn walkInstruction( |
| 1949 | 1949 | false, |
| 1950 | 1950 | call_ctx, |
| 1951 | 1951 | ); |
| 1952 | var init: DocData.WalkResult = try self.walkRef( | |
| 1952 | const init: DocData.WalkResult = try self.walkRef( | |
| 1953 | 1953 | file, |
| 1954 | 1954 | parent_scope, |
| 1955 | 1955 | parent_src, |
| ... | ... | @@ -1980,7 +1980,7 @@ fn walkInstruction( |
| 1980 | 1980 | const pl_node = data[@intFromEnum(inst)].pl_node; |
| 1981 | 1981 | const extra = file.zir.extraData(Zir.Inst.BuiltinCall, pl_node.payload_index); |
| 1982 | 1982 | |
| 1983 | var modifier: DocData.WalkResult = try self.walkRef( | |
| 1983 | const modifier: DocData.WalkResult = try self.walkRef( | |
| 1984 | 1984 | file, |
| 1985 | 1985 | parent_scope, |
| 1986 | 1986 | parent_src, |
| ... | ... | @@ -1989,7 +1989,7 @@ fn walkInstruction( |
| 1989 | 1989 | call_ctx, |
| 1990 | 1990 | ); |
| 1991 | 1991 | |
| 1992 | var callee: DocData.WalkResult = try self.walkRef( | |
| 1992 | const callee: DocData.WalkResult = try self.walkRef( | |
| 1993 | 1993 | file, |
| 1994 | 1994 | parent_scope, |
| 1995 | 1995 | parent_src, |
| ... | ... | @@ -1998,7 +1998,7 @@ fn walkInstruction( |
| 1998 | 1998 | call_ctx, |
| 1999 | 1999 | ); |
| 2000 | 2000 | |
| 2001 | var args: DocData.WalkResult = try self.walkRef( | |
| 2001 | const args: DocData.WalkResult = try self.walkRef( | |
| 2002 | 2002 | file, |
| 2003 | 2003 | parent_scope, |
| 2004 | 2004 | parent_src, |
| ... | ... | @@ -2028,7 +2028,7 @@ fn walkInstruction( |
| 2028 | 2028 | const pl_node = data[@intFromEnum(inst)].pl_node; |
| 2029 | 2029 | const extra = file.zir.extraData(Zir.Inst.Bin, pl_node.payload_index); |
| 2030 | 2030 | |
| 2031 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 2031 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 2032 | 2032 | file, |
| 2033 | 2033 | parent_scope, |
| 2034 | 2034 | parent_src, |
| ... | ... | @@ -2036,7 +2036,7 @@ fn walkInstruction( |
| 2036 | 2036 | false, |
| 2037 | 2037 | call_ctx, |
| 2038 | 2038 | ); |
| 2039 | var rhs: DocData.WalkResult = try self.walkRef( | |
| 2039 | const rhs: DocData.WalkResult = try self.walkRef( | |
| 2040 | 2040 | file, |
| 2041 | 2041 | parent_scope, |
| 2042 | 2042 | parent_src, |
| ... | ... | @@ -2060,7 +2060,7 @@ fn walkInstruction( |
| 2060 | 2060 | const pl_node = data[@intFromEnum(inst)].pl_node; |
| 2061 | 2061 | const extra = file.zir.extraData(Zir.Inst.Bin, pl_node.payload_index); |
| 2062 | 2062 | |
| 2063 | var lhs: DocData.WalkResult = try self.walkRef( | |
| 2063 | const lhs: DocData.WalkResult = try self.walkRef( | |
| 2064 | 2064 | file, |
| 2065 | 2065 | parent_scope, |
| 2066 | 2066 | parent_src, |
| ... | ... | @@ -2068,7 +2068,7 @@ fn walkInstruction( |
| 2068 | 2068 | false, |
| 2069 | 2069 | call_ctx, |
| 2070 | 2070 | ); |
| 2071 | var rhs: DocData.WalkResult = try self.walkRef( | |
| 2071 | const rhs: DocData.WalkResult = try self.walkRef( | |
| 2072 | 2072 | file, |
| 2073 | 2073 | parent_scope, |
| 2074 | 2074 | parent_src, |
| ... | ... | @@ -2090,7 +2090,7 @@ fn walkInstruction( |
| 2090 | 2090 | // .elem_type => { |
| 2091 | 2091 | // const un_node = data[@intFromEnum(inst)].un_node; |
| 2092 | 2092 | |
| 2093 | // var operand: DocData.WalkResult = try self.walkRef( | |
| 2093 | // const operand: DocData.WalkResult = try self.walkRef( | |
| 2094 | 2094 | // file, |
| 2095 | 2095 | // parent_scope, parent_src, |
| 2096 | 2096 | // un_node.operand, |
| ... | ... | @@ -2158,7 +2158,7 @@ fn walkInstruction( |
| 2158 | 2158 | address_space = ref_result.expr; |
| 2159 | 2159 | extra_index += 1; |
| 2160 | 2160 | } |
| 2161 | var bit_start: ?DocData.Expr = null; | |
| 2161 | const bit_start: ?DocData.Expr = null; | |
| 2162 | 2162 | if (ptr.flags.has_bit_range) { |
| 2163 | 2163 | const ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 2164 | 2164 | const ref_result = try self.walkRef( |
| ... | ... | @@ -2292,7 +2292,7 @@ fn walkInstruction( |
| 2292 | 2292 | const array_data = try self.arena.alloc(usize, operands.len - 1); |
| 2293 | 2293 | |
| 2294 | 2294 | std.debug.assert(operands.len > 0); |
| 2295 | var array_type = try self.walkRef( | |
| 2295 | const array_type = try self.walkRef( | |
| 2296 | 2296 | file, |
| 2297 | 2297 | parent_scope, |
| 2298 | 2298 | parent_src, |
| ... | ... | @@ -2352,7 +2352,7 @@ fn walkInstruction( |
| 2352 | 2352 | const array_data = try self.arena.alloc(usize, operands.len - 1); |
| 2353 | 2353 | |
| 2354 | 2354 | std.debug.assert(operands.len > 0); |
| 2355 | var array_type = try self.walkRef( | |
| 2355 | const array_type = try self.walkRef( | |
| 2356 | 2356 | file, |
| 2357 | 2357 | parent_scope, |
| 2358 | 2358 | parent_src, |
| ... | ... | @@ -2578,7 +2578,7 @@ fn walkInstruction( |
| 2578 | 2578 | const pl_node = data[@intFromEnum(inst)].pl_node; |
| 2579 | 2579 | const extra = file.zir.extraData(Zir.Inst.Block, pl_node.payload_index); |
| 2580 | 2580 | const body = file.zir.extra[extra.end..][extra.data.body_len - 1]; |
| 2581 | var operand: DocData.WalkResult = try self.walkRef( | |
| 2581 | const operand: DocData.WalkResult = try self.walkRef( | |
| 2582 | 2582 | file, |
| 2583 | 2583 | parent_scope, |
| 2584 | 2584 | parent_src, |
| ... | ... | @@ -2903,7 +2903,7 @@ fn walkInstruction( |
| 2903 | 2903 | => { |
| 2904 | 2904 | const un_node = data[@intFromEnum(inst)].un_node; |
| 2905 | 2905 | |
| 2906 | var operand: DocData.WalkResult = try self.walkRef( | |
| 2906 | const operand: DocData.WalkResult = try self.walkRef( | |
| 2907 | 2907 | file, |
| 2908 | 2908 | parent_scope, |
| 2909 | 2909 | parent_src, |
| ... | ... | @@ -2920,7 +2920,7 @@ fn walkInstruction( |
| 2920 | 2920 | .struct_init_empty_ref_result => { |
| 2921 | 2921 | const un_node = data[@intFromEnum(inst)].un_node; |
| 2922 | 2922 | |
| 2923 | var operand: DocData.WalkResult = try self.walkRef( | |
| 2923 | const operand: DocData.WalkResult = try self.walkRef( | |
| 2924 | 2924 | file, |
| 2925 | 2925 | parent_scope, |
| 2926 | 2926 | parent_src, |
| ... | ... | @@ -3937,7 +3937,7 @@ fn walkInstruction( |
| 3937 | 3937 | try self.exprs.append(self.arena, last_type); |
| 3938 | 3938 | |
| 3939 | 3939 | const ptr_index = self.exprs.items.len; |
| 3940 | var ptr: DocData.WalkResult = try self.walkRef( | |
| 3940 | const ptr: DocData.WalkResult = try self.walkRef( | |
| 3941 | 3941 | file, |
| 3942 | 3942 | parent_scope, |
| 3943 | 3943 | parent_src, |
| ... | ... | @@ -3948,7 +3948,7 @@ fn walkInstruction( |
| 3948 | 3948 | try self.exprs.append(self.arena, ptr.expr); |
| 3949 | 3949 | |
| 3950 | 3950 | const expected_value_index = self.exprs.items.len; |
| 3951 | var expected_value: DocData.WalkResult = try self.walkRef( | |
| 3951 | const expected_value: DocData.WalkResult = try self.walkRef( | |
| 3952 | 3952 | file, |
| 3953 | 3953 | parent_scope, |
| 3954 | 3954 | parent_src, |
| ... | ... | @@ -3959,7 +3959,7 @@ fn walkInstruction( |
| 3959 | 3959 | try self.exprs.append(self.arena, expected_value.expr); |
| 3960 | 3960 | |
| 3961 | 3961 | const new_value_index = self.exprs.items.len; |
| 3962 | var new_value: DocData.WalkResult = try self.walkRef( | |
| 3962 | const new_value: DocData.WalkResult = try self.walkRef( | |
| 3963 | 3963 | file, |
| 3964 | 3964 | parent_scope, |
| 3965 | 3965 | parent_src, |
| ... | ... | @@ -3970,7 +3970,7 @@ fn walkInstruction( |
| 3970 | 3970 | try self.exprs.append(self.arena, new_value.expr); |
| 3971 | 3971 | |
| 3972 | 3972 | const success_order_index = self.exprs.items.len; |
| 3973 | var success_order: DocData.WalkResult = try self.walkRef( | |
| 3973 | const success_order: DocData.WalkResult = try self.walkRef( | |
| 3974 | 3974 | file, |
| 3975 | 3975 | parent_scope, |
| 3976 | 3976 | parent_src, |
| ... | ... | @@ -3981,7 +3981,7 @@ fn walkInstruction( |
| 3981 | 3981 | try self.exprs.append(self.arena, success_order.expr); |
| 3982 | 3982 | |
| 3983 | 3983 | const failure_order_index = self.exprs.items.len; |
| 3984 | var failure_order: DocData.WalkResult = try self.walkRef( | |
| 3984 | const failure_order: DocData.WalkResult = try self.walkRef( | |
| 3985 | 3985 | file, |
| 3986 | 3986 | parent_scope, |
| 3987 | 3987 | parent_src, |
src/Compilation.zig+6-6| ... | ... | @@ -1759,7 +1759,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1759 | 1759 | |
| 1760 | 1760 | const digest = hash.final(); |
| 1761 | 1761 | const artifact_sub_dir = try std.fs.path.join(arena, &[_][]const u8{ "o", &digest }); |
| 1762 | var artifact_dir = try options.local_cache_directory.handle.makeOpenPath(artifact_sub_dir, .{}); | |
| 1762 | const artifact_dir = try options.local_cache_directory.handle.makeOpenPath(artifact_sub_dir, .{}); | |
| 1763 | 1763 | owned_link_dir = artifact_dir; |
| 1764 | 1764 | const link_artifact_directory: Directory = .{ |
| 1765 | 1765 | .handle = artifact_dir, |
| ... | ... | @@ -2173,7 +2173,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 2173 | 2173 | // LLD might drop some symbols as unused during LTO and GCing, therefore, |
| 2174 | 2174 | // we force mark them for resolution here. |
| 2175 | 2175 | |
| 2176 | var tls_index_sym = switch (comp.getTarget().cpu.arch) { | |
| 2176 | const tls_index_sym = switch (comp.getTarget().cpu.arch) { | |
| 2177 | 2177 | .x86 => "__tls_index", |
| 2178 | 2178 | else => "_tls_index", |
| 2179 | 2179 | }; |
| ... | ... | @@ -2576,7 +2576,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2576 | 2576 | var artifact_dir = try comp.local_cache_directory.handle.openDir(o_sub_path, .{}); |
| 2577 | 2577 | defer artifact_dir.close(); |
| 2578 | 2578 | |
| 2579 | var dir_path = try comp.local_cache_directory.join(comp.gpa, &.{o_sub_path}); | |
| 2579 | const dir_path = try comp.local_cache_directory.join(comp.gpa, &.{o_sub_path}); | |
| 2580 | 2580 | defer comp.gpa.free(dir_path); |
| 2581 | 2581 | |
| 2582 | 2582 | module.zig_cache_artifact_directory = .{ |
| ... | ... | @@ -4961,7 +4961,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 4961 | 4961 | |
| 4962 | 4962 | var cli_diagnostics = resinator.cli.Diagnostics.init(comp.gpa); |
| 4963 | 4963 | defer cli_diagnostics.deinit(); |
| 4964 | var options = resinator.cli.parse(comp.gpa, resinator_args.items, &cli_diagnostics) catch |err| switch (err) { | |
| 4964 | const options = resinator.cli.parse(comp.gpa, resinator_args.items, &cli_diagnostics) catch |err| switch (err) { | |
| 4965 | 4965 | error.ParseError => { |
| 4966 | 4966 | return comp.failWin32ResourceCli(win32_resource, &cli_diagnostics); |
| 4967 | 4967 | }, |
| ... | ... | @@ -5062,7 +5062,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 5062 | 5062 | log.warn("failed to delete '{s}': {s}", .{ out_dep_path, @errorName(err) }); |
| 5063 | 5063 | }; |
| 5064 | 5064 | |
| 5065 | var full_input = std.fs.cwd().readFileAlloc(arena, out_rcpp_path, std.math.maxInt(usize)) catch |err| switch (err) { | |
| 5065 | const full_input = std.fs.cwd().readFileAlloc(arena, out_rcpp_path, std.math.maxInt(usize)) catch |err| switch (err) { | |
| 5066 | 5066 | error.OutOfMemory => return error.OutOfMemory, |
| 5067 | 5067 | else => |e| { |
| 5068 | 5068 | return comp.failWin32Resource(win32_resource, "failed to read preprocessed file '{s}': {s}", .{ out_rcpp_path, @errorName(e) }); |
| ... | ... | @@ -5072,7 +5072,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 5072 | 5072 | var mapping_results = try resinator.source_mapping.parseAndRemoveLineCommands(arena, full_input, full_input, .{ .initial_filename = rc_src.src_path }); |
| 5073 | 5073 | defer mapping_results.mappings.deinit(arena); |
| 5074 | 5074 | |
| 5075 | var final_input = resinator.comments.removeComments(mapping_results.result, mapping_results.result, &mapping_results.mappings); | |
| 5075 | const final_input = resinator.comments.removeComments(mapping_results.result, mapping_results.result, &mapping_results.mappings); | |
| 5076 | 5076 | |
| 5077 | 5077 | var output_file = zig_cache_tmp_dir.createFile(out_res_path, .{}) catch |err| { |
| 5078 | 5078 | return comp.failWin32Resource(win32_resource, "failed to create output file '{s}': {s}", .{ out_res_path, @errorName(err) }); |
src/Package/Fetch/git.zig+9-9| ... | ... | @@ -83,7 +83,7 @@ pub const Repository = struct { |
| 83 | 83 | ) !void { |
| 84 | 84 | try repository.odb.seekOid(commit_oid); |
| 85 | 85 | const tree_oid = tree_oid: { |
| 86 | var commit_object = try repository.odb.readObject(); | |
| 86 | const commit_object = try repository.odb.readObject(); | |
| 87 | 87 | if (commit_object.type != .commit) return error.NotACommit; |
| 88 | 88 | break :tree_oid try getCommitTree(commit_object.data); |
| 89 | 89 | }; |
| ... | ... | @@ -122,14 +122,14 @@ pub const Repository = struct { |
| 122 | 122 | var file = try dir.createFile(entry.name, .{}); |
| 123 | 123 | defer file.close(); |
| 124 | 124 | try repository.odb.seekOid(entry.oid); |
| 125 | var file_object = try repository.odb.readObject(); | |
| 125 | const file_object = try repository.odb.readObject(); | |
| 126 | 126 | if (file_object.type != .blob) return error.InvalidFile; |
| 127 | 127 | try file.writeAll(file_object.data); |
| 128 | 128 | try file.sync(); |
| 129 | 129 | }, |
| 130 | 130 | .symlink => { |
| 131 | 131 | try repository.odb.seekOid(entry.oid); |
| 132 | var symlink_object = try repository.odb.readObject(); | |
| 132 | const symlink_object = try repository.odb.readObject(); | |
| 133 | 133 | if (symlink_object.type != .blob) return error.InvalidFile; |
| 134 | 134 | const link_name = symlink_object.data; |
| 135 | 135 | dir.symLink(link_name, entry.name, .{}) catch |e| { |
| ... | ... | @@ -1230,7 +1230,7 @@ fn resolveDeltaChain( |
| 1230 | 1230 | const delta_offset = delta_offsets[i]; |
| 1231 | 1231 | try pack.seekTo(delta_offset); |
| 1232 | 1232 | const delta_header = try EntryHeader.read(pack.reader()); |
| 1233 | var delta_data = try readObjectRaw(allocator, pack.reader(), delta_header.uncompressedLength()); | |
| 1233 | const delta_data = try readObjectRaw(allocator, pack.reader(), delta_header.uncompressedLength()); | |
| 1234 | 1234 | defer allocator.free(delta_data); |
| 1235 | 1235 | var delta_stream = std.io.fixedBufferStream(delta_data); |
| 1236 | 1236 | const delta_reader = delta_stream.reader(); |
| ... | ... | @@ -1238,7 +1238,7 @@ fn resolveDeltaChain( |
| 1238 | 1238 | const expanded_size = try readSizeVarInt(delta_reader); |
| 1239 | 1239 | |
| 1240 | 1240 | const expanded_alloc_size = std.math.cast(usize, expanded_size) orelse return error.ObjectTooLarge; |
| 1241 | var expanded_data = try allocator.alloc(u8, expanded_alloc_size); | |
| 1241 | const expanded_data = try allocator.alloc(u8, expanded_alloc_size); | |
| 1242 | 1242 | errdefer allocator.free(expanded_data); |
| 1243 | 1243 | var expanded_delta_stream = std.io.fixedBufferStream(expanded_data); |
| 1244 | 1244 | var base_stream = std.io.fixedBufferStream(base_data); |
| ... | ... | @@ -1259,7 +1259,7 @@ fn readObjectRaw(allocator: Allocator, reader: anytype, size: u64) ![]u8 { |
| 1259 | 1259 | var buffered_reader = std.io.bufferedReader(reader); |
| 1260 | 1260 | var decompress_stream = try std.compress.zlib.decompressStream(allocator, buffered_reader.reader()); |
| 1261 | 1261 | defer decompress_stream.deinit(); |
| 1262 | var data = try allocator.alloc(u8, alloc_size); | |
| 1262 | const data = try allocator.alloc(u8, alloc_size); | |
| 1263 | 1263 | errdefer allocator.free(data); |
| 1264 | 1264 | try decompress_stream.reader().readNoEof(data); |
| 1265 | 1265 | _ = decompress_stream.reader().readByte() catch |e| switch (e) { |
| ... | ... | @@ -1290,14 +1290,14 @@ fn expandDelta(base_object: anytype, delta_reader: anytype, writer: anytype) !vo |
| 1290 | 1290 | size2: bool, |
| 1291 | 1291 | size3: bool, |
| 1292 | 1292 | } = @bitCast(inst.value); |
| 1293 | var offset_parts: packed struct { offset1: u8, offset2: u8, offset3: u8, offset4: u8 } = .{ | |
| 1293 | const offset_parts: packed struct { offset1: u8, offset2: u8, offset3: u8, offset4: u8 } = .{ | |
| 1294 | 1294 | .offset1 = if (available.offset1) try delta_reader.readByte() else 0, |
| 1295 | 1295 | .offset2 = if (available.offset2) try delta_reader.readByte() else 0, |
| 1296 | 1296 | .offset3 = if (available.offset3) try delta_reader.readByte() else 0, |
| 1297 | 1297 | .offset4 = if (available.offset4) try delta_reader.readByte() else 0, |
| 1298 | 1298 | }; |
| 1299 | 1299 | const offset: u32 = @bitCast(offset_parts); |
| 1300 | var size_parts: packed struct { size1: u8, size2: u8, size3: u8 } = .{ | |
| 1300 | const size_parts: packed struct { size1: u8, size2: u8, size3: u8 } = .{ | |
| 1301 | 1301 | .size1 = if (available.size1) try delta_reader.readByte() else 0, |
| 1302 | 1302 | .size2 = if (available.size2) try delta_reader.readByte() else 0, |
| 1303 | 1303 | .size3 = if (available.size3) try delta_reader.readByte() else 0, |
| ... | ... | @@ -1414,7 +1414,7 @@ test "packfile indexing and checkout" { |
| 1414 | 1414 | defer walker.deinit(); |
| 1415 | 1415 | while (try walker.next()) |entry| { |
| 1416 | 1416 | if (entry.kind != .file) continue; |
| 1417 | var path = try testing.allocator.dupe(u8, entry.path); | |
| 1417 | const path = try testing.allocator.dupe(u8, entry.path); | |
| 1418 | 1418 | errdefer testing.allocator.free(path); |
| 1419 | 1419 | mem.replaceScalar(u8, path, std.fs.path.sep, '/'); |
| 1420 | 1420 | try actual_files.append(testing.allocator, path); |
src/Sema.zig+9-9| ... | ... | @@ -22899,7 +22899,7 @@ fn checkSimdBinOp( |
| 22899 | 22899 | const rhs_ty = sema.typeOf(uncasted_rhs); |
| 22900 | 22900 | |
| 22901 | 22901 | try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src); |
| 22902 | var vec_len: ?usize = if (lhs_ty.zigTypeTag(mod) == .Vector) lhs_ty.vectorLen(mod) else null; | |
| 22902 | const vec_len: ?usize = if (lhs_ty.zigTypeTag(mod) == .Vector) lhs_ty.vectorLen(mod) else null; | |
| 22903 | 22903 | const result_ty = try sema.resolvePeerTypes(block, src, &.{ uncasted_lhs, uncasted_rhs }, .{ |
| 22904 | 22904 | .override = &[_]?LazySrcLoc{ lhs_src, rhs_src }, |
| 22905 | 22905 | }); |
| ... | ... | @@ -23286,8 +23286,8 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 23286 | 23286 | |
| 23287 | 23287 | const elem_ty = try sema.resolveType(block, elem_ty_src, extra.elem_type); |
| 23288 | 23288 | try sema.checkVectorElemType(block, elem_ty_src, elem_ty); |
| 23289 | var a = try sema.resolveInst(extra.a); | |
| 23290 | var b = try sema.resolveInst(extra.b); | |
| 23289 | const a = try sema.resolveInst(extra.a); | |
| 23290 | const b = try sema.resolveInst(extra.b); | |
| 23291 | 23291 | var mask = try sema.resolveInst(extra.mask); |
| 23292 | 23292 | var mask_ty = sema.typeOf(mask); |
| 23293 | 23293 | |
| ... | ... | @@ -23328,7 +23328,7 @@ fn analyzeShuffle( |
| 23328 | 23328 | .child = elem_ty.toIntern(), |
| 23329 | 23329 | }); |
| 23330 | 23330 | |
| 23331 | var maybe_a_len = switch (sema.typeOf(a).zigTypeTag(mod)) { | |
| 23331 | const maybe_a_len = switch (sema.typeOf(a).zigTypeTag(mod)) { | |
| 23332 | 23332 | .Array, .Vector => sema.typeOf(a).arrayLen(mod), |
| 23333 | 23333 | .Undefined => null, |
| 23334 | 23334 | else => return sema.fail(block, a_src, "expected vector or array with element type '{}', found '{}'", .{ |
| ... | ... | @@ -23336,7 +23336,7 @@ fn analyzeShuffle( |
| 23336 | 23336 | sema.typeOf(a).fmt(sema.mod), |
| 23337 | 23337 | }), |
| 23338 | 23338 | }; |
| 23339 | var maybe_b_len = switch (sema.typeOf(b).zigTypeTag(mod)) { | |
| 23339 | const maybe_b_len = switch (sema.typeOf(b).zigTypeTag(mod)) { | |
| 23340 | 23340 | .Array, .Vector => sema.typeOf(b).arrayLen(mod), |
| 23341 | 23341 | .Undefined => null, |
| 23342 | 23342 | else => return sema.fail(block, b_src, "expected vector or array with element type '{}', found '{}'", .{ |
| ... | ... | @@ -23801,7 +23801,7 @@ fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 23801 | 23801 | const call_src = inst_data.src(); |
| 23802 | 23802 | |
| 23803 | 23803 | const extra = sema.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data; |
| 23804 | var func = try sema.resolveInst(extra.callee); | |
| 23804 | const func = try sema.resolveInst(extra.callee); | |
| 23805 | 23805 | |
| 23806 | 23806 | const modifier_ty = try sema.getBuiltinType("CallModifier"); |
| 23807 | 23807 | const air_ref = try sema.resolveInst(extra.modifier); |
| ... | ... | @@ -23859,7 +23859,7 @@ fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 23859 | 23859 | return sema.fail(block, args_src, "expected a tuple, found '{}'", .{args_ty.fmt(sema.mod)}); |
| 23860 | 23860 | } |
| 23861 | 23861 | |
| 23862 | var resolved_args: []Air.Inst.Ref = try sema.arena.alloc(Air.Inst.Ref, args_ty.structFieldCount(mod)); | |
| 23862 | const resolved_args: []Air.Inst.Ref = try sema.arena.alloc(Air.Inst.Ref, args_ty.structFieldCount(mod)); | |
| 23863 | 23863 | for (resolved_args, 0..) |*resolved, i| { |
| 23864 | 23864 | resolved.* = try sema.tupleFieldValByIndex(block, args_src, args, @intCast(i), args_ty); |
| 23865 | 23865 | } |
| ... | ... | @@ -33274,8 +33274,8 @@ fn resolvePeerTypes( |
| 33274 | 33274 | else => {}, |
| 33275 | 33275 | } |
| 33276 | 33276 | |
| 33277 | var peer_tys = try sema.arena.alloc(?Type, instructions.len); | |
| 33278 | var peer_vals = try sema.arena.alloc(?Value, instructions.len); | |
| 33277 | const peer_tys = try sema.arena.alloc(?Type, instructions.len); | |
| 33278 | const peer_vals = try sema.arena.alloc(?Value, instructions.len); | |
| 33279 | 33279 | |
| 33280 | 33280 | for (instructions, peer_tys, peer_vals) |inst, *ty, *val| { |
| 33281 | 33281 | ty.* = sema.typeOf(inst); |
src/arch/riscv64/CodeGen.zig+5| ... | ... | @@ -2648,6 +2648,11 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues { |
| 2648 | 2648 | // conventions |
| 2649 | 2649 | var next_register: usize = 0; |
| 2650 | 2650 | var next_stack_offset: u32 = 0; |
| 2651 | // TODO: this is never assigned, which is a bug, but I don't know how this code works | |
| 2652 | // well enough to try and fix it. I *think* `next_register += next_stack_offset` is | |
| 2653 | // supposed to be `next_stack_offset += param_size` in every case where it appears. | |
| 2654 | _ = &next_stack_offset; | |
| 2655 | ||
| 2651 | 2656 | const argument_registers = [_]Register{ .a0, .a1, .a2, .a3, .a4, .a5, .a6, .a7 }; |
| 2652 | 2657 | |
| 2653 | 2658 | for (fn_info.param_types.get(ip), result.args) |ty, *result_arg| { |
src/arch/sparc64/CodeGen.zig+4| ... | ... | @@ -4481,6 +4481,10 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type, role: RegisterView) |
| 4481 | 4481 | |
| 4482 | 4482 | var next_register: usize = 0; |
| 4483 | 4483 | var next_stack_offset: u32 = 0; |
| 4484 | // TODO: this is never assigned, which is a bug, but I don't know how this code works | |
| 4485 | // well enough to try and fix it. I *think* `next_register += next_stack_offset` is | |
| 4486 | // supposed to be `next_stack_offset += param_size` in every case where it appears. | |
| 4487 | _ = &next_stack_offset; | |
| 4484 | 4488 | |
| 4485 | 4489 | // The caller puts the argument in %o0-%o5, which becomes %i0-%i5 inside the callee. |
| 4486 | 4490 | const argument_registers = switch (role) { |
src/arch/wasm/CodeGen.zig+4-4| ... | ... | @@ -2139,7 +2139,7 @@ fn airRetPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2139 | 2139 | const mod = func.bin_file.base.options.module.?; |
| 2140 | 2140 | const child_type = func.typeOfIndex(inst).childType(mod); |
| 2141 | 2141 | |
| 2142 | var result = result: { | |
| 2142 | const result = result: { | |
| 2143 | 2143 | if (!child_type.isFnOrHasRuntimeBitsIgnoreComptime(mod)) { |
| 2144 | 2144 | break :result try func.allocStack(Type.usize); // create pointer to void |
| 2145 | 2145 | } |
| ... | ... | @@ -5001,7 +5001,7 @@ fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5001 | 5001 | return func.finishAir(inst, try WValue.toLocal(.stack, func, elem_ty), &.{ bin_op.lhs, bin_op.rhs }); |
| 5002 | 5002 | }, |
| 5003 | 5003 | else => { |
| 5004 | var stack_vec = try func.allocStack(array_ty); | |
| 5004 | const stack_vec = try func.allocStack(array_ty); | |
| 5005 | 5005 | try func.store(stack_vec, array, array_ty, 0); |
| 5006 | 5006 | |
| 5007 | 5007 | // Is a non-unrolled vector (v128) |
| ... | ... | @@ -5944,7 +5944,7 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro |
| 5944 | 5944 | rhs.free(func); |
| 5945 | 5945 | }; |
| 5946 | 5946 | |
| 5947 | var bin_op = try (try func.binOp(lhs, rhs, lhs_ty, op)).toLocal(func, lhs_ty); | |
| 5947 | const bin_op = try (try func.binOp(lhs, rhs, lhs_ty, op)).toLocal(func, lhs_ty); | |
| 5948 | 5948 | var result = if (wasm_bits != int_info.bits) blk: { |
| 5949 | 5949 | break :blk try (try func.wrapOperand(bin_op, lhs_ty)).toLocal(func, lhs_ty); |
| 5950 | 5950 | } else bin_op; |
| ... | ... | @@ -6335,7 +6335,7 @@ fn airMulAdd(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6335 | 6335 | const lhs_ext = try func.fpext(lhs, ty, Type.f32); |
| 6336 | 6336 | const addend_ext = try func.fpext(addend, ty, Type.f32); |
| 6337 | 6337 | // call to compiler-rt `fn fmaf(f32, f32, f32) f32` |
| 6338 | var result = try func.callIntrinsic( | |
| 6338 | const result = try func.callIntrinsic( | |
| 6339 | 6339 | "fmaf", |
| 6340 | 6340 | &.{ .f32_type, .f32_type, .f32_type }, |
| 6341 | 6341 | Type.f32, |
src/arch/x86_64/CodeGen.zig+1-1| ... | ... | @@ -2181,7 +2181,7 @@ fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void { |
| 2181 | 2181 | const ret_reg = param_regs[0]; |
| 2182 | 2182 | const enum_mcv = MCValue{ .register = param_regs[1] }; |
| 2183 | 2183 | |
| 2184 | var exitlude_jump_relocs = try self.gpa.alloc(Mir.Inst.Index, enum_ty.enumFieldCount(mod)); | |
| 2184 | const exitlude_jump_relocs = try self.gpa.alloc(Mir.Inst.Index, enum_ty.enumFieldCount(mod)); | |
| 2185 | 2185 | defer self.gpa.free(exitlude_jump_relocs); |
| 2186 | 2186 | |
| 2187 | 2187 | const data_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp); |
src/arch/x86_64/Disassembler.zig+1-2| ... | ... | @@ -234,13 +234,12 @@ fn inst(encoding: Encoding, args: struct { |
| 234 | 234 | op3: Instruction.Operand = .none, |
| 235 | 235 | op4: Instruction.Operand = .none, |
| 236 | 236 | }) Instruction { |
| 237 | var i = Instruction{ .encoding = encoding, .prefix = args.prefix, .ops = .{ | |
| 237 | return .{ .encoding = encoding, .prefix = args.prefix, .ops = .{ | |
| 238 | 238 | args.op1, |
| 239 | 239 | args.op2, |
| 240 | 240 | args.op3, |
| 241 | 241 | args.op4, |
| 242 | 242 | } }; |
| 243 | return i; | |
| 244 | 243 | } |
| 245 | 244 | |
| 246 | 245 | const Prefixes = struct { |
src/arch/x86_64/Lower.zig+1-1| ... | ... | @@ -342,7 +342,7 @@ fn emit(lower: *Lower, prefix: Prefix, mnemonic: Mnemonic, ops: []const Operand) |
| 342 | 342 | .Lib => lower.bin_file.options.link_mode == .Static, |
| 343 | 343 | }; |
| 344 | 344 | |
| 345 | var emit_prefix = prefix; | |
| 345 | const emit_prefix = prefix; | |
| 346 | 346 | var emit_mnemonic = mnemonic; |
| 347 | 347 | var emit_ops_storage: [4]Operand = undefined; |
| 348 | 348 | const emit_ops = emit_ops_storage[0..ops.len]; |
src/arch/x86_64/encoder.zig+2-2| ... | ... | @@ -244,7 +244,7 @@ pub const Instruction = struct { |
| 244 | 244 | }), |
| 245 | 245 | }, |
| 246 | 246 | .imm => |imm| if (enc_op.isSigned()) { |
| 247 | var imms = imm.asSigned(enc_op.immBitSize()); | |
| 247 | const imms = imm.asSigned(enc_op.immBitSize()); | |
| 248 | 248 | if (imms < 0) try writer.writeByte('-'); |
| 249 | 249 | try writer.print("0x{x}", .{@abs(imms)}); |
| 250 | 250 | } else try writer.print("0x{x}", .{imm.asUnsigned(enc_op.immBitSize())}), |
| ... | ... | @@ -1077,7 +1077,7 @@ fn expectEqualHexStrings(expected: []const u8, given: []const u8, assembly: []co |
| 1077 | 1077 | const given_fmt = try std.fmt.allocPrint(testing.allocator, "{x}", .{std.fmt.fmtSliceHexLower(given)}); |
| 1078 | 1078 | defer testing.allocator.free(given_fmt); |
| 1079 | 1079 | const idx = std.mem.indexOfDiff(u8, expected_fmt, given_fmt).?; |
| 1080 | var padding = try testing.allocator.alloc(u8, idx + 5); | |
| 1080 | const padding = try testing.allocator.alloc(u8, idx + 5); | |
| 1081 | 1081 | defer testing.allocator.free(padding); |
| 1082 | 1082 | @memset(padding, ' '); |
| 1083 | 1083 | std.debug.print("\nASM: {s}\nEXP: {s}\nGIV: {s}\n{s}^ -- first differing byte\n", .{ |
src/aro_translate_c.zig+2-2| ... | ... | @@ -346,7 +346,7 @@ fn transFnDecl(c: *Context, fn_decl: NodeIndex) Error!void { |
| 346 | 346 | defer block_scope.deinit(); |
| 347 | 347 | |
| 348 | 348 | var scope = &block_scope.base; |
| 349 | _ = scope; | |
| 349 | _ = &scope; | |
| 350 | 350 | |
| 351 | 351 | var param_id: c_uint = 0; |
| 352 | 352 | for (proto_payload.data.params, fn_ty.data.func.params) |*param, param_info| { |
| ... | ... | @@ -534,7 +534,7 @@ fn transFnType( |
| 534 | 534 | ctx: FnProtoContext, |
| 535 | 535 | ) !ZigNode { |
| 536 | 536 | const param_count: usize = fn_ty.data.func.params.len; |
| 537 | var fn_params = try c.arena.alloc(ast.Payload.Param, param_count); | |
| 537 | const fn_params = try c.arena.alloc(ast.Payload.Param, param_count); | |
| 538 | 538 | |
| 539 | 539 | for (fn_ty.data.func.params, fn_params) |param_info, *param_node| { |
| 540 | 540 | const param_ty = param_info.ty; |
src/codegen.zig+1-1| ... | ... | @@ -368,7 +368,7 @@ pub fn generateSymbol( |
| 368 | 368 | .bytes => |bytes| try code.appendSlice(bytes), |
| 369 | 369 | .elems, .repeated_elem => { |
| 370 | 370 | var index: u64 = 0; |
| 371 | var len_including_sentinel = | |
| 371 | const len_including_sentinel = | |
| 372 | 372 | array_type.len + @intFromBool(array_type.sentinel != .none); |
| 373 | 373 | while (index < len_including_sentinel) : (index += 1) { |
| 374 | 374 | switch (try generateSymbol(bin_file, src_loc, .{ |
src/codegen/llvm/BitcodeReader.zig+1-1| ... | ... | @@ -410,7 +410,7 @@ fn readVbr(bc: *BitcodeReader, comptime T: type, bits: u7) !T { |
| 410 | 410 | var result: u64 = 0; |
| 411 | 411 | var shift: u6 = 0; |
| 412 | 412 | while (true) { |
| 413 | var chunk = try bc.readFixed(u64, bits); | |
| 413 | const chunk = try bc.readFixed(u64, bits); | |
| 414 | 414 | result |= (chunk & (chunk_msb - 1)) << shift; |
| 415 | 415 | if (chunk & chunk_msb == 0) break; |
| 416 | 416 | shift += chunk_bits; |
src/codegen/spirv.zig+4-4| ... | ... | @@ -1284,7 +1284,7 @@ const DeclGen = struct { |
| 1284 | 1284 | |
| 1285 | 1285 | const elem_ty = ty.childType(mod); |
| 1286 | 1286 | const elem_ty_ref = try self.resolveType(elem_ty, .indirect); |
| 1287 | var total_len = std.math.cast(u32, ty.arrayLenIncludingSentinel(mod)) orelse { | |
| 1287 | const total_len = std.math.cast(u32, ty.arrayLenIncludingSentinel(mod)) orelse { | |
| 1288 | 1288 | return self.fail("array type of {} elements is too large", .{ty.arrayLenIncludingSentinel(mod)}); |
| 1289 | 1289 | }; |
| 1290 | 1290 | const ty_ref = if (!elem_ty.hasRuntimeBitsIgnoreComptime(mod)) blk: { |
| ... | ... | @@ -2115,7 +2115,7 @@ const DeclGen = struct { |
| 2115 | 2115 | const child_ty = ty.childType(mod); |
| 2116 | 2116 | const vector_len = ty.vectorLen(mod); |
| 2117 | 2117 | |
| 2118 | var constituents = try self.gpa.alloc(IdRef, vector_len); | |
| 2118 | const constituents = try self.gpa.alloc(IdRef, vector_len); | |
| 2119 | 2119 | defer self.gpa.free(constituents); |
| 2120 | 2120 | |
| 2121 | 2121 | for (constituents, 0..) |*constituent, i| { |
| ... | ... | @@ -2312,7 +2312,7 @@ const DeclGen = struct { |
| 2312 | 2312 | if (ty.isVector(mod)) { |
| 2313 | 2313 | const child_ty = ty.childType(mod); |
| 2314 | 2314 | const vector_len = ty.vectorLen(mod); |
| 2315 | var constituents = try self.gpa.alloc(IdRef, vector_len); | |
| 2315 | const constituents = try self.gpa.alloc(IdRef, vector_len); | |
| 2316 | 2316 | defer self.gpa.free(constituents); |
| 2317 | 2317 | |
| 2318 | 2318 | for (constituents, 0..) |*constituent, i| { |
| ... | ... | @@ -2727,7 +2727,7 @@ const DeclGen = struct { |
| 2727 | 2727 | const child_ty = ty.childType(mod); |
| 2728 | 2728 | const vector_len = ty.vectorLen(mod); |
| 2729 | 2729 | |
| 2730 | var constituents = try self.gpa.alloc(IdRef, vector_len); | |
| 2730 | const constituents = try self.gpa.alloc(IdRef, vector_len); | |
| 2731 | 2731 | defer self.gpa.free(constituents); |
| 2732 | 2732 | |
| 2733 | 2733 | for (constituents, 0..) |*constituent, i| { |
src/link/C.zig+1-1| ... | ... | @@ -103,7 +103,7 @@ pub fn openPath(gpa: Allocator, sub_path: []const u8, options: link.Options) !*C |
| 103 | 103 | }); |
| 104 | 104 | errdefer file.close(); |
| 105 | 105 | |
| 106 | var c_file = try gpa.create(C); | |
| 106 | const c_file = try gpa.create(C); | |
| 107 | 107 | errdefer gpa.destroy(c_file); |
| 108 | 108 | |
| 109 | 109 | c_file.* = .{ |
src/link/Coff.zig+5-5| ... | ... | @@ -563,7 +563,7 @@ fn allocateAtom(self: *Coff, atom_index: Atom.Index, new_atom_size: u32, alignme |
| 563 | 563 | |
| 564 | 564 | // First we look for an appropriately sized free list node. |
| 565 | 565 | // The list is unordered. We'll just take the first thing that works. |
| 566 | var vaddr = blk: { | |
| 566 | const vaddr = blk: { | |
| 567 | 567 | var i: usize = 0; |
| 568 | 568 | while (i < free_list.items.len) { |
| 569 | 569 | const big_atom_index = free_list.items[i]; |
| ... | ... | @@ -815,7 +815,7 @@ fn writeAtom(self: *Coff, atom_index: Atom.Index, code: []u8) !void { |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | fn debugMem(allocator: Allocator, handle: std.ChildProcess.Id, pvaddr: std.os.windows.LPVOID, code: []const u8) !void { |
| 818 | var buffer = try allocator.alloc(u8, code.len); | |
| 818 | const buffer = try allocator.alloc(u8, code.len); | |
| 819 | 819 | defer allocator.free(buffer); |
| 820 | 820 | const memread = try std.os.windows.ReadProcessMemory(handle, pvaddr, buffer); |
| 821 | 821 | log.debug("to write: {x}", .{std.fmt.fmtSliceHexLower(code)}); |
| ... | ... | @@ -1071,7 +1071,7 @@ pub fn updateFunc(self: *Coff, mod: *Module, func_index: InternPool.Index, air: |
| 1071 | 1071 | &code_buffer, |
| 1072 | 1072 | .none, |
| 1073 | 1073 | ); |
| 1074 | var code = switch (res) { | |
| 1074 | const code = switch (res) { | |
| 1075 | 1075 | .ok => code_buffer.items, |
| 1076 | 1076 | .fail => |em| { |
| 1077 | 1077 | decl.analysis = .codegen_failure; |
| ... | ... | @@ -1132,7 +1132,7 @@ fn lowerConst(self: *Coff, name: []const u8, tv: TypedValue, required_alignment: |
| 1132 | 1132 | const res = try codegen.generateSymbol(&self.base, src_loc, tv, &code_buffer, .none, .{ |
| 1133 | 1133 | .parent_atom_index = self.getAtom(atom_index).getSymbolIndex().?, |
| 1134 | 1134 | }); |
| 1135 | var code = switch (res) { | |
| 1135 | const code = switch (res) { | |
| 1136 | 1136 | .ok => code_buffer.items, |
| 1137 | 1137 | .fail => |em| return .{ .fail = em }, |
| 1138 | 1138 | }; |
| ... | ... | @@ -1196,7 +1196,7 @@ pub fn updateDecl( |
| 1196 | 1196 | }, &code_buffer, .none, .{ |
| 1197 | 1197 | .parent_atom_index = atom.getSymbolIndex().?, |
| 1198 | 1198 | }); |
| 1199 | var code = switch (res) { | |
| 1199 | const code = switch (res) { | |
| 1200 | 1200 | .ok => code_buffer.items, |
| 1201 | 1201 | .fail => |em| { |
| 1202 | 1202 | decl.analysis = .codegen_failure; |
src/link/Dwarf.zig+3-3| ... | ... | @@ -303,7 +303,7 @@ pub const DeclState = struct { |
| 303 | 303 | // DW.AT.name, DW.FORM.string |
| 304 | 304 | try dbg_info_buffer.writer().print("{d}\x00", .{field_index}); |
| 305 | 305 | // DW.AT.type, DW.FORM.ref4 |
| 306 | var index = dbg_info_buffer.items.len; | |
| 306 | const index = dbg_info_buffer.items.len; | |
| 307 | 307 | try dbg_info_buffer.resize(index + 4); |
| 308 | 308 | try self.addTypeRelocGlobal(atom_index, field_ty.toType(), @intCast(index)); |
| 309 | 309 | // DW.AT.data_member_location, DW.FORM.udata |
| ... | ... | @@ -329,7 +329,7 @@ pub const DeclState = struct { |
| 329 | 329 | // DW.AT.name, DW.FORM.string |
| 330 | 330 | try dbg_info_buffer.writer().print("{d}\x00", .{field_index}); |
| 331 | 331 | // DW.AT.type, DW.FORM.ref4 |
| 332 | var index = dbg_info_buffer.items.len; | |
| 332 | const index = dbg_info_buffer.items.len; | |
| 333 | 333 | try dbg_info_buffer.resize(index + 4); |
| 334 | 334 | try self.addTypeRelocGlobal(atom_index, field_ty.toType(), @intCast(index)); |
| 335 | 335 | // DW.AT.data_member_location, DW.FORM.udata |
| ... | ... | @@ -350,7 +350,7 @@ pub const DeclState = struct { |
| 350 | 350 | dbg_info_buffer.appendSliceAssumeCapacity(field_name); |
| 351 | 351 | dbg_info_buffer.appendAssumeCapacity(0); |
| 352 | 352 | // DW.AT.type, DW.FORM.ref4 |
| 353 | var index = dbg_info_buffer.items.len; | |
| 353 | const index = dbg_info_buffer.items.len; | |
| 354 | 354 | try dbg_info_buffer.resize(index + 4); |
| 355 | 355 | try self.addTypeRelocGlobal(atom_index, field_ty.toType(), @intCast(index)); |
| 356 | 356 | // DW.AT.data_member_location, DW.FORM.udata |
src/link/Elf.zig+5-5| ... | ... | @@ -967,7 +967,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node |
| 967 | 967 | // --verbose-link |
| 968 | 968 | if (self.base.options.verbose_link) try self.dumpArgv(comp); |
| 969 | 969 | |
| 970 | var csu = try CsuObjects.init(arena, self.base.options, comp); | |
| 970 | const csu = try CsuObjects.init(arena, self.base.options, comp); | |
| 971 | 971 | const compiler_rt_path: ?[]const u8 = blk: { |
| 972 | 972 | if (comp.compiler_rt_lib) |x| break :blk x.full_object_path; |
| 973 | 973 | if (comp.compiler_rt_obj) |x| break :blk x.full_object_path; |
| ... | ... | @@ -1493,7 +1493,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void { |
| 1493 | 1493 | } else null; |
| 1494 | 1494 | const gc_sections = self.base.options.gc_sections orelse false; |
| 1495 | 1495 | |
| 1496 | var csu = try CsuObjects.init(arena, self.base.options, comp); | |
| 1496 | const csu = try CsuObjects.init(arena, self.base.options, comp); | |
| 1497 | 1497 | const compiler_rt_path: ?[]const u8 = blk: { |
| 1498 | 1498 | if (comp.compiler_rt_lib) |x| break :blk x.full_object_path; |
| 1499 | 1499 | if (comp.compiler_rt_obj) |x| break :blk x.full_object_path; |
| ... | ... | @@ -2599,7 +2599,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 2599 | 2599 | try argv.append(full_out_path); |
| 2600 | 2600 | |
| 2601 | 2601 | // csu prelude |
| 2602 | var csu = try CsuObjects.init(arena, self.base.options, comp); | |
| 2602 | const csu = try CsuObjects.init(arena, self.base.options, comp); | |
| 2603 | 2603 | if (csu.crt0) |v| try argv.append(v); |
| 2604 | 2604 | if (csu.crti) |v| try argv.append(v); |
| 2605 | 2605 | if (csu.crtbegin) |v| try argv.append(v); |
| ... | ... | @@ -3852,7 +3852,7 @@ fn sortPhdrs(self: *Elf) error{OutOfMemory}!void { |
| 3852 | 3852 | backlinks[entry.phndx] = @as(u16, @intCast(i)); |
| 3853 | 3853 | } |
| 3854 | 3854 | |
| 3855 | var slice = try self.phdrs.toOwnedSlice(gpa); | |
| 3855 | const slice = try self.phdrs.toOwnedSlice(gpa); | |
| 3856 | 3856 | defer gpa.free(slice); |
| 3857 | 3857 | |
| 3858 | 3858 | try self.phdrs.ensureTotalCapacityPrecise(gpa, slice.len); |
| ... | ... | @@ -3957,7 +3957,7 @@ fn sortShdrs(self: *Elf) !void { |
| 3957 | 3957 | backlinks[entry.shndx] = @as(u16, @intCast(i)); |
| 3958 | 3958 | } |
| 3959 | 3959 | |
| 3960 | var slice = try self.shdrs.toOwnedSlice(gpa); | |
| 3960 | const slice = try self.shdrs.toOwnedSlice(gpa); | |
| 3961 | 3961 | defer gpa.free(slice); |
| 3962 | 3962 | |
| 3963 | 3963 | try self.shdrs.ensureTotalCapacityPrecise(gpa, slice.len); |
src/link/Elf/eh_frame.zig+1-1| ... | ... | @@ -217,7 +217,7 @@ pub const Iterator = struct { |
| 217 | 217 | var stream = std.io.fixedBufferStream(it.data[it.pos..]); |
| 218 | 218 | const reader = stream.reader(); |
| 219 | 219 | |
| 220 | var size = try reader.readInt(u32, .little); | |
| 220 | const size = try reader.readInt(u32, .little); | |
| 221 | 221 | if (size == 0xFFFFFFFF) @panic("TODO"); |
| 222 | 222 | |
| 223 | 223 | const id = try reader.readInt(u32, .little); |
src/link/MachO.zig+7-7| ... | ... | @@ -2252,7 +2252,7 @@ pub fn updateFunc(self: *MachO, mod: *Module, func_index: InternPool.Index, air: |
| 2252 | 2252 | else |
| 2253 | 2253 | try codegen.generateFunction(&self.base, decl.srcLoc(mod), func_index, air, liveness, &code_buffer, .none); |
| 2254 | 2254 | |
| 2255 | var code = switch (res) { | |
| 2255 | const code = switch (res) { | |
| 2256 | 2256 | .ok => code_buffer.items, |
| 2257 | 2257 | .fail => |em| { |
| 2258 | 2258 | decl.analysis = .codegen_failure; |
| ... | ... | @@ -2332,7 +2332,7 @@ fn lowerConst( |
| 2332 | 2332 | const res = try codegen.generateSymbol(&self.base, src_loc, tv, &code_buffer, .none, .{ |
| 2333 | 2333 | .parent_atom_index = self.getAtom(atom_index).getSymbolIndex().?, |
| 2334 | 2334 | }); |
| 2335 | var code = switch (res) { | |
| 2335 | const code = switch (res) { | |
| 2336 | 2336 | .ok => code_buffer.items, |
| 2337 | 2337 | .fail => |em| return .{ .fail = em }, |
| 2338 | 2338 | }; |
| ... | ... | @@ -2418,7 +2418,7 @@ pub fn updateDecl(self: *MachO, mod: *Module, decl_index: Module.Decl.Index) !vo |
| 2418 | 2418 | .parent_atom_index = sym_index, |
| 2419 | 2419 | }); |
| 2420 | 2420 | |
| 2421 | var code = switch (res) { | |
| 2421 | const code = switch (res) { | |
| 2422 | 2422 | .ok => code_buffer.items, |
| 2423 | 2423 | .fail => |em| { |
| 2424 | 2424 | decl.analysis = .codegen_failure; |
| ... | ... | @@ -2587,7 +2587,7 @@ fn updateThreadlocalVariable(self: *MachO, module: *Module, decl_index: Module.D |
| 2587 | 2587 | .parent_atom_index = init_sym_index, |
| 2588 | 2588 | }); |
| 2589 | 2589 | |
| 2590 | var code = switch (res) { | |
| 2590 | const code = switch (res) { | |
| 2591 | 2591 | .ok => code_buffer.items, |
| 2592 | 2592 | .fail => |em| { |
| 2593 | 2593 | decl.analysis = .codegen_failure; |
| ... | ... | @@ -3427,7 +3427,7 @@ fn allocateAtom(self: *MachO, atom_index: Atom.Index, new_atom_size: u64, alignm |
| 3427 | 3427 | |
| 3428 | 3428 | // First we look for an appropriately sized free list node. |
| 3429 | 3429 | // The list is unordered. We'll just take the first thing that works. |
| 3430 | var vaddr = blk: { | |
| 3430 | const vaddr = blk: { | |
| 3431 | 3431 | var i: usize = 0; |
| 3432 | 3432 | while (i < free_list.items.len) { |
| 3433 | 3433 | const big_atom_index = free_list.items[i]; |
| ... | ... | @@ -3971,7 +3971,7 @@ fn writeDyldInfoData(self: *MachO) !void { |
| 3971 | 3971 | link_seg.filesize = needed_size; |
| 3972 | 3972 | assert(mem.isAlignedGeneric(u64, link_seg.fileoff + link_seg.filesize, @alignOf(u64))); |
| 3973 | 3973 | |
| 3974 | var buffer = try gpa.alloc(u8, needed_size); | |
| 3974 | const buffer = try gpa.alloc(u8, needed_size); | |
| 3975 | 3975 | defer gpa.free(buffer); |
| 3976 | 3976 | @memset(buffer, 0); |
| 3977 | 3977 | |
| ... | ... | @@ -5228,7 +5228,7 @@ fn reportMissingLibraryError( |
| 5228 | 5228 | ) error{OutOfMemory}!void { |
| 5229 | 5229 | const gpa = self.base.allocator; |
| 5230 | 5230 | try self.misc_errors.ensureUnusedCapacity(gpa, 1); |
| 5231 | var notes = try gpa.alloc(File.ErrorMsg, checked_paths.len); | |
| 5231 | const notes = try gpa.alloc(File.ErrorMsg, checked_paths.len); | |
| 5232 | 5232 | errdefer gpa.free(notes); |
| 5233 | 5233 | for (checked_paths, notes) |path, *note| { |
| 5234 | 5234 | note.* = .{ .msg = try std.fmt.allocPrint(gpa, "tried {s}", .{path}) }; |
src/link/MachO/Archive.zig+3-3| ... | ... | @@ -98,7 +98,7 @@ pub fn parse(self: *Archive, allocator: Allocator, reader: anytype) !void { |
| 98 | 98 | _ = try reader.readBytesNoEof(SARMAG); |
| 99 | 99 | self.header = try reader.readStruct(ar_hdr); |
| 100 | 100 | const name_or_length = try self.header.nameOrLength(); |
| 101 | var embedded_name = try parseName(allocator, name_or_length, reader); | |
| 101 | const embedded_name = try parseName(allocator, name_or_length, reader); | |
| 102 | 102 | log.debug("parsing archive '{s}' at '{s}'", .{ embedded_name, self.name }); |
| 103 | 103 | defer allocator.free(embedded_name); |
| 104 | 104 | |
| ... | ... | @@ -124,7 +124,7 @@ fn parseName(allocator: Allocator, name_or_length: ar_hdr.NameOrLength, reader: |
| 124 | 124 | |
| 125 | 125 | fn parseTableOfContents(self: *Archive, allocator: Allocator, reader: anytype) !void { |
| 126 | 126 | const symtab_size = try reader.readInt(u32, .little); |
| 127 | var symtab = try allocator.alloc(u8, symtab_size); | |
| 127 | const symtab = try allocator.alloc(u8, symtab_size); | |
| 128 | 128 | defer allocator.free(symtab); |
| 129 | 129 | |
| 130 | 130 | reader.readNoEof(symtab) catch { |
| ... | ... | @@ -133,7 +133,7 @@ fn parseTableOfContents(self: *Archive, allocator: Allocator, reader: anytype) ! |
| 133 | 133 | }; |
| 134 | 134 | |
| 135 | 135 | const strtab_size = try reader.readInt(u32, .little); |
| 136 | var strtab = try allocator.alloc(u8, strtab_size); | |
| 136 | const strtab = try allocator.alloc(u8, strtab_size); | |
| 137 | 137 | defer allocator.free(strtab); |
| 138 | 138 | |
| 139 | 139 | reader.readNoEof(strtab) catch { |
src/link/MachO/Dylib.zig+3-3| ... | ... | @@ -167,7 +167,7 @@ pub fn parseFromBinary( |
| 167 | 167 | .REEXPORT_DYLIB => { |
| 168 | 168 | if (should_lookup_reexports) { |
| 169 | 169 | // Parse install_name to dependent dylib. |
| 170 | var id = try Id.fromLoadCommand( | |
| 170 | const id = try Id.fromLoadCommand( | |
| 171 | 171 | allocator, |
| 172 | 172 | cmd.cast(macho.dylib_command).?, |
| 173 | 173 | cmd.getDylibPathName(), |
| ... | ... | @@ -410,7 +410,7 @@ pub fn parseFromStub( |
| 410 | 410 | |
| 411 | 411 | log.debug(" (found re-export '{s}')", .{lib}); |
| 412 | 412 | |
| 413 | var dep_id = try Id.default(allocator, lib); | |
| 413 | const dep_id = try Id.default(allocator, lib); | |
| 414 | 414 | try dependent_libs.writeItem(.{ .id = dep_id, .parent = dylib_id }); |
| 415 | 415 | } |
| 416 | 416 | } |
| ... | ... | @@ -527,7 +527,7 @@ pub fn parseFromStub( |
| 527 | 527 | |
| 528 | 528 | log.debug(" (found re-export '{s}')", .{lib}); |
| 529 | 529 | |
| 530 | var dep_id = try Id.default(allocator, lib); | |
| 530 | const dep_id = try Id.default(allocator, lib); | |
| 531 | 531 | try dependent_libs.writeItem(.{ .id = dep_id, .parent = dylib_id }); |
| 532 | 532 | } |
| 533 | 533 | } |
src/link/MachO/Trie.zig+8-8| ... | ... | @@ -150,7 +150,7 @@ pub fn deinit(self: *Trie, allocator: Allocator) void { |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | test "Trie node count" { |
| 153 | var gpa = testing.allocator; | |
| 153 | const gpa = testing.allocator; | |
| 154 | 154 | var trie: Trie = .{}; |
| 155 | 155 | defer trie.deinit(gpa); |
| 156 | 156 | try trie.init(gpa); |
| ... | ... | @@ -196,7 +196,7 @@ test "Trie node count" { |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | test "Trie basic" { |
| 199 | var gpa = testing.allocator; | |
| 199 | const gpa = testing.allocator; | |
| 200 | 200 | var trie: Trie = .{}; |
| 201 | 201 | defer trie.deinit(gpa); |
| 202 | 202 | try trie.init(gpa); |
| ... | ... | @@ -254,7 +254,7 @@ fn expectEqualHexStrings(expected: []const u8, given: []const u8) !void { |
| 254 | 254 | const given_fmt = try std.fmt.allocPrint(testing.allocator, "{x}", .{std.fmt.fmtSliceHexLower(given)}); |
| 255 | 255 | defer testing.allocator.free(given_fmt); |
| 256 | 256 | const idx = mem.indexOfDiff(u8, expected_fmt, given_fmt).?; |
| 257 | var padding = try testing.allocator.alloc(u8, idx + 5); | |
| 257 | const padding = try testing.allocator.alloc(u8, idx + 5); | |
| 258 | 258 | defer testing.allocator.free(padding); |
| 259 | 259 | @memset(padding, ' '); |
| 260 | 260 | std.debug.print("\nEXP: {s}\nGIV: {s}\n{s}^ -- first differing byte\n", .{ expected_fmt, given_fmt, padding }); |
| ... | ... | @@ -292,7 +292,7 @@ test "write Trie to a byte stream" { |
| 292 | 292 | 0x3, 0x0, 0x80, 0x20, 0x0, // terminal node |
| 293 | 293 | }; |
| 294 | 294 | |
| 295 | var buffer = try gpa.alloc(u8, trie.size); | |
| 295 | const buffer = try gpa.alloc(u8, trie.size); | |
| 296 | 296 | defer gpa.free(buffer); |
| 297 | 297 | var stream = std.io.fixedBufferStream(buffer); |
| 298 | 298 | { |
| ... | ... | @@ -331,7 +331,7 @@ test "parse Trie from byte stream" { |
| 331 | 331 | |
| 332 | 332 | try trie.finalize(gpa); |
| 333 | 333 | |
| 334 | var out_buffer = try gpa.alloc(u8, trie.size); | |
| 334 | const out_buffer = try gpa.alloc(u8, trie.size); | |
| 335 | 335 | defer gpa.free(out_buffer); |
| 336 | 336 | var out_stream = std.io.fixedBufferStream(out_buffer); |
| 337 | 337 | _ = try trie.write(out_stream.writer()); |
| ... | ... | @@ -362,7 +362,7 @@ test "ordering bug" { |
| 362 | 362 | 0x00, 0x12, 0x03, 0x00, 0xD8, 0x0A, 0x00, |
| 363 | 363 | }; |
| 364 | 364 | |
| 365 | var buffer = try gpa.alloc(u8, trie.size); | |
| 365 | const buffer = try gpa.alloc(u8, trie.size); | |
| 366 | 366 | defer gpa.free(buffer); |
| 367 | 367 | var stream = std.io.fixedBufferStream(buffer); |
| 368 | 368 | // Writing finalized trie again should yield the same result. |
| ... | ... | @@ -426,7 +426,7 @@ pub const Node = struct { |
| 426 | 426 | // To: A -> C -> B |
| 427 | 427 | const mid = try allocator.create(Node); |
| 428 | 428 | mid.* = .{ .base = self.base }; |
| 429 | var to_label = try allocator.dupe(u8, edge.label[match..]); | |
| 429 | const to_label = try allocator.dupe(u8, edge.label[match..]); | |
| 430 | 430 | allocator.free(edge.label); |
| 431 | 431 | const to_node = edge.to; |
| 432 | 432 | edge.to = mid; |
| ... | ... | @@ -573,7 +573,7 @@ pub const Node = struct { |
| 573 | 573 | /// Updates offset of this node in the output byte stream. |
| 574 | 574 | fn finalize(self: *Node, offset_in_trie: u64) !FinalizeResult { |
| 575 | 575 | var stream = std.io.countingWriter(std.io.null_writer); |
| 576 | var writer = stream.writer(); | |
| 576 | const writer = stream.writer(); | |
| 577 | 577 | |
| 578 | 578 | var node_size: u64 = 0; |
| 579 | 579 | if (self.terminal_info) |info| { |
src/link/MachO/UnwindInfo.zig+1-1| ... | ... | @@ -417,7 +417,7 @@ pub fn collect(info: *UnwindInfo, macho_file: *MachO) !void { |
| 417 | 417 | gop.value_ptr.count += 1; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | var slice = common_encodings_counts.values(); | |
| 420 | const slice = common_encodings_counts.values(); | |
| 421 | 421 | mem.sort(CommonEncWithCount, slice, {}, CommonEncWithCount.greaterThan); |
| 422 | 422 | |
| 423 | 423 | var i: u7 = 0; |
src/link/MachO/eh_frame.zig+1-1| ... | ... | @@ -586,7 +586,7 @@ pub const Iterator = struct { |
| 586 | 586 | var stream = std.io.fixedBufferStream(it.data[it.pos..]); |
| 587 | 587 | const reader = stream.reader(); |
| 588 | 588 | |
| 589 | var size = try reader.readInt(u32, .little); | |
| 589 | const size = try reader.readInt(u32, .little); | |
| 590 | 590 | if (size == 0xFFFFFFFF) { |
| 591 | 591 | log.debug("MachO doesn't support 64bit DWARF CFI __eh_frame records", .{}); |
| 592 | 592 | return error.BadDwarfCfi; |
src/link/MachO/load_commands.zig+1-1| ... | ... | @@ -112,7 +112,7 @@ pub fn calcMinHeaderPad(gpa: Allocator, options: *const link.Options, ctx: CalcL |
| 112 | 112 | log.debug("minimum requested headerpad size 0x{x}", .{padding + @sizeOf(macho.mach_header_64)}); |
| 113 | 113 | |
| 114 | 114 | if (options.headerpad_max_install_names) { |
| 115 | var min_headerpad_size: u32 = try calcLCsSize(gpa, options, ctx, true); | |
| 115 | const min_headerpad_size: u32 = try calcLCsSize(gpa, options, ctx, true); | |
| 116 | 116 | log.debug("headerpad_max_install_names minimum headerpad size 0x{x}", .{ |
| 117 | 117 | min_headerpad_size + @sizeOf(macho.mach_header_64), |
| 118 | 118 | }); |
src/link/MachO/zld.zig+1-1| ... | ... | @@ -503,7 +503,7 @@ pub fn linkWithZld( |
| 503 | 503 | const size = math.cast(usize, linkedit.fileoff - start) orelse return error.Overflow; |
| 504 | 504 | if (size > 0) { |
| 505 | 505 | log.debug("zeroing out zerofill area of length {x} at {x}", .{ size, start }); |
| 506 | var padding = try gpa.alloc(u8, size); | |
| 506 | const padding = try gpa.alloc(u8, size); | |
| 507 | 507 | defer gpa.free(padding); |
| 508 | 508 | @memset(padding, 0); |
| 509 | 509 | try macho_file.base.file.?.pwriteAll(padding, start); |
src/link/Plan9.zig+6-6| ... | ... | @@ -300,7 +300,7 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*Plan9 { |
| 300 | 300 | else => return error.UnsupportedP9Architecture, |
| 301 | 301 | }; |
| 302 | 302 | |
| 303 | var arena_allocator = std.heap.ArenaAllocator.init(gpa); | |
| 303 | const arena_allocator = std.heap.ArenaAllocator.init(gpa); | |
| 304 | 304 | |
| 305 | 305 | const self = try gpa.create(Plan9); |
| 306 | 306 | self.* = .{ |
| ... | ... | @@ -467,7 +467,7 @@ pub fn lowerUnnamedConst(self: *Plan9, tv: TypedValue, decl_index: Module.Decl.I |
| 467 | 467 | |
| 468 | 468 | const sym_index = try self.allocateSymbolIndex(); |
| 469 | 469 | const new_atom_idx = try self.createAtom(); |
| 470 | var info: Atom = .{ | |
| 470 | const info: Atom = .{ | |
| 471 | 471 | .type = .d, |
| 472 | 472 | .offset = null, |
| 473 | 473 | .sym_index = sym_index, |
| ... | ... | @@ -496,7 +496,7 @@ pub fn lowerUnnamedConst(self: *Plan9, tv: TypedValue, decl_index: Module.Decl.I |
| 496 | 496 | }, |
| 497 | 497 | }; |
| 498 | 498 | // duped_code is freed when the unnamed const is freed |
| 499 | var duped_code = try self.base.allocator.dupe(u8, code); | |
| 499 | const duped_code = try self.base.allocator.dupe(u8, code); | |
| 500 | 500 | errdefer self.base.allocator.free(duped_code); |
| 501 | 501 | const new_atom = self.getAtomPtr(new_atom_idx); |
| 502 | 502 | new_atom.* = info; |
| ... | ... | @@ -1024,7 +1024,7 @@ pub fn freeDecl(self: *Plan9, decl_index: Module.Decl.Index) void { |
| 1024 | 1024 | const decl = mod.declPtr(decl_index); |
| 1025 | 1025 | const is_fn = decl.val.isFuncBody(mod); |
| 1026 | 1026 | if (is_fn) { |
| 1027 | var symidx_and_submap = self.fn_decl_table.get(decl.getFileScope(mod)).?; | |
| 1027 | const symidx_and_submap = self.fn_decl_table.get(decl.getFileScope(mod)).?; | |
| 1028 | 1028 | var submap = symidx_and_submap.functions; |
| 1029 | 1029 | if (submap.fetchSwapRemove(decl_index)) |removed_entry| { |
| 1030 | 1030 | self.base.allocator.free(removed_entry.value.code); |
| ... | ... | @@ -1204,7 +1204,7 @@ fn updateLazySymbolAtom(self: *Plan9, sym: File.LazySymbol, atom_index: Atom.Ind |
| 1204 | 1204 | }, |
| 1205 | 1205 | }; |
| 1206 | 1206 | // duped_code is freed when the atom is freed |
| 1207 | var duped_code = try self.base.allocator.dupe(u8, code); | |
| 1207 | const duped_code = try self.base.allocator.dupe(u8, code); | |
| 1208 | 1208 | errdefer self.base.allocator.free(duped_code); |
| 1209 | 1209 | self.getAtomPtr(atom_index).code = .{ |
| 1210 | 1210 | .code_ptr = duped_code.ptr, |
| ... | ... | @@ -1489,7 +1489,7 @@ pub fn lowerAnonDecl(self: *Plan9, decl_val: InternPool.Index, src_loc: Module.S |
| 1489 | 1489 | // to put it in some location. |
| 1490 | 1490 | // ... |
| 1491 | 1491 | const gpa = self.base.allocator; |
| 1492 | var gop = try self.anon_decls.getOrPut(gpa, decl_val); | |
| 1492 | const gop = try self.anon_decls.getOrPut(gpa, decl_val); | |
| 1493 | 1493 | const mod = self.base.options.module.?; |
| 1494 | 1494 | if (!gop.found_existing) { |
| 1495 | 1495 | const ty = mod.intern_pool.typeOf(decl_val).toType(); |
src/link/Wasm.zig+5-5| ... | ... | @@ -860,7 +860,7 @@ fn resolveSymbolsInArchives(wasm: *Wasm) !void { |
| 860 | 860 | // Parse object and and resolve symbols again before we check remaining |
| 861 | 861 | // undefined symbols. |
| 862 | 862 | const object_file_index = @as(u16, @intCast(wasm.objects.items.len)); |
| 863 | var object = try archive.parseObject(wasm.base.allocator, offset.items[0]); | |
| 863 | const object = try archive.parseObject(wasm.base.allocator, offset.items[0]); | |
| 864 | 864 | try wasm.objects.append(wasm.base.allocator, object); |
| 865 | 865 | try wasm.resolveSymbolsInObject(object_file_index); |
| 866 | 866 | |
| ... | ... | @@ -1344,7 +1344,7 @@ pub fn deinit(wasm: *Wasm) void { |
| 1344 | 1344 | /// Will re-use slots when a symbol was freed at an earlier stage. |
| 1345 | 1345 | pub fn allocateSymbol(wasm: *Wasm) !u32 { |
| 1346 | 1346 | try wasm.symbols.ensureUnusedCapacity(wasm.base.allocator, 1); |
| 1347 | var symbol: Symbol = .{ | |
| 1347 | const symbol: Symbol = .{ | |
| 1348 | 1348 | .name = std.math.maxInt(u32), // will be set after updateDecl as well as during atom creation for decls |
| 1349 | 1349 | .flags = @intFromEnum(Symbol.Flag.WASM_SYM_BINDING_LOCAL), |
| 1350 | 1350 | .tag = .undefined, // will be set after updateDecl |
| ... | ... | @@ -1655,7 +1655,7 @@ pub fn getGlobalSymbol(wasm: *Wasm, name: []const u8, lib_name: ?[]const u8) !u3 |
| 1655 | 1655 | symbol.setUndefined(true); |
| 1656 | 1656 | |
| 1657 | 1657 | const sym_index = if (wasm.symbols_free_list.popOrNull()) |index| index else blk: { |
| 1658 | var index = @as(u32, @intCast(wasm.symbols.items.len)); | |
| 1658 | const index: u32 = @intCast(wasm.symbols.items.len); | |
| 1659 | 1659 | try wasm.symbols.ensureUnusedCapacity(wasm.base.allocator, 1); |
| 1660 | 1660 | wasm.symbols.items.len += 1; |
| 1661 | 1661 | break :blk index; |
| ... | ... | @@ -2632,7 +2632,7 @@ fn setupImports(wasm: *Wasm) !void { |
| 2632 | 2632 | |
| 2633 | 2633 | // We copy the import to a new import to ensure the names contain references |
| 2634 | 2634 | // to the internal string table, rather than of the object file. |
| 2635 | var new_imp: types.Import = .{ | |
| 2635 | const new_imp: types.Import = .{ | |
| 2636 | 2636 | .module_name = try wasm.string_table.put(wasm.base.allocator, object.string_table.get(import.module_name)), |
| 2637 | 2637 | .name = try wasm.string_table.put(wasm.base.allocator, object.string_table.get(import.name)), |
| 2638 | 2638 | .kind = import.kind, |
| ... | ... | @@ -3800,7 +3800,7 @@ fn writeToFile( |
| 3800 | 3800 | const table_loc = wasm.findGlobalSymbol("__indirect_function_table").?; |
| 3801 | 3801 | const table_sym = table_loc.getSymbol(wasm); |
| 3802 | 3802 | |
| 3803 | var flags: u32 = if (table_sym.index == 0) 0x0 else 0x02; // passive with implicit 0-index table or set table index manually | |
| 3803 | const flags: u32 = if (table_sym.index == 0) 0x0 else 0x02; // passive with implicit 0-index table or set table index manually | |
| 3804 | 3804 | try leb.writeULEB128(binary_writer, flags); |
| 3805 | 3805 | if (flags == 0x02) { |
| 3806 | 3806 | try leb.writeULEB128(binary_writer, table_sym.index); |
src/link/Wasm/Object.zig+3-3| ... | ... | @@ -252,7 +252,7 @@ fn checkLegacyIndirectFunctionTable(object: *Object) !?Symbol { |
| 252 | 252 | return error.MissingTableSymbols; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | var table_import: types.Import = for (object.imports) |imp| { | |
| 255 | const table_import: types.Import = for (object.imports) |imp| { | |
| 256 | 256 | if (imp.kind == .table) { |
| 257 | 257 | break imp; |
| 258 | 258 | } |
| ... | ... | @@ -512,7 +512,7 @@ fn Parser(comptime ReaderType: type) type { |
| 512 | 512 | try assertEnd(reader); |
| 513 | 513 | }, |
| 514 | 514 | .code => { |
| 515 | var start = reader.context.bytes_left; | |
| 515 | const start = reader.context.bytes_left; | |
| 516 | 516 | var index: u32 = 0; |
| 517 | 517 | const count = try readLeb(u32, reader); |
| 518 | 518 | while (index < count) : (index += 1) { |
| ... | ... | @@ -532,7 +532,7 @@ fn Parser(comptime ReaderType: type) type { |
| 532 | 532 | } |
| 533 | 533 | }, |
| 534 | 534 | .data => { |
| 535 | var start = reader.context.bytes_left; | |
| 535 | const start = reader.context.bytes_left; | |
| 536 | 536 | var index: u32 = 0; |
| 537 | 537 | const count = try readLeb(u32, reader); |
| 538 | 538 | while (index < count) : (index += 1) { |
src/link/tapi/yaml.zig+1-1| ... | ... | @@ -491,7 +491,7 @@ pub fn stringify(allocator: Allocator, input: anytype, writer: anytype) !void { |
| 491 | 491 | var arena = ArenaAllocator.init(allocator); |
| 492 | 492 | defer arena.deinit(); |
| 493 | 493 | |
| 494 | var maybe_value = try Value.encode(arena.allocator(), input); | |
| 494 | const maybe_value = try Value.encode(arena.allocator(), input); | |
| 495 | 495 | |
| 496 | 496 | if (maybe_value) |value| { |
| 497 | 497 | // TODO should we output as an explicit doc? |
src/main.zig+7-7| ... | ... | @@ -4479,7 +4479,7 @@ fn cmdRc(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4479 | 4479 | try stdout_writer.writeByte('\n'); |
| 4480 | 4480 | } |
| 4481 | 4481 | |
| 4482 | var full_input = full_input: { | |
| 4482 | const full_input = full_input: { | |
| 4483 | 4483 | if (options.preprocess != .no) { |
| 4484 | 4484 | if (!build_options.have_llvm) { |
| 4485 | 4485 | fatal("clang not available: compiler built without LLVM extensions", .{}); |
| ... | ... | @@ -4526,7 +4526,7 @@ fn cmdRc(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4526 | 4526 | } |
| 4527 | 4527 | |
| 4528 | 4528 | if (process.can_spawn) { |
| 4529 | var result = std.ChildProcess.run(.{ | |
| 4529 | const result = std.ChildProcess.run(.{ | |
| 4530 | 4530 | .allocator = gpa, |
| 4531 | 4531 | .argv = argv.items, |
| 4532 | 4532 | .max_output_bytes = std.math.maxInt(u32), |
| ... | ... | @@ -4593,7 +4593,7 @@ fn cmdRc(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4593 | 4593 | var mapping_results = try resinator.source_mapping.parseAndRemoveLineCommands(gpa, full_input, full_input, .{ .initial_filename = options.input_filename }); |
| 4594 | 4594 | defer mapping_results.mappings.deinit(gpa); |
| 4595 | 4595 | |
| 4596 | var final_input = resinator.comments.removeComments(mapping_results.result, mapping_results.result, &mapping_results.mappings); | |
| 4596 | const final_input = resinator.comments.removeComments(mapping_results.result, mapping_results.result, &mapping_results.mappings); | |
| 4597 | 4597 | |
| 4598 | 4598 | var output_file = std.fs.cwd().createFile(options.output_filename, .{}) catch |err| { |
| 4599 | 4599 | try resinator.utils.renderErrorMessage(stderr.writer(), stderr_config, .err, "unable to create output file '{s}': {s}", .{ options.output_filename, @errorName(err) }); |
| ... | ... | @@ -4762,7 +4762,7 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void { |
| 4762 | 4762 | |
| 4763 | 4763 | const libc_installation: ?*LibCInstallation = libc: { |
| 4764 | 4764 | if (input_file) |libc_file| { |
| 4765 | var libc = try arena.create(LibCInstallation); | |
| 4765 | const libc = try arena.create(LibCInstallation); | |
| 4766 | 4766 | libc.* = LibCInstallation.parse(arena, libc_file, cross_target) catch |err| { |
| 4767 | 4767 | fatal("unable to parse libc file at path {s}: {s}", .{ libc_file, @errorName(err) }); |
| 4768 | 4768 | }; |
| ... | ... | @@ -4781,7 +4781,7 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void { |
| 4781 | 4781 | const target = cross_target.toTarget(); |
| 4782 | 4782 | const is_native_abi = cross_target.isNativeAbi(); |
| 4783 | 4783 | |
| 4784 | var libc_dirs = Compilation.detectLibCIncludeDirs( | |
| 4784 | const libc_dirs = Compilation.detectLibCIncludeDirs( | |
| 4785 | 4785 | arena, |
| 4786 | 4786 | zig_lib_directory.path.?, |
| 4787 | 4787 | target, |
| ... | ... | @@ -4960,7 +4960,7 @@ pub const usage_build = |
| 4960 | 4960 | pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4961 | 4961 | const work_around_btrfs_bug = builtin.os.tag == .linux and |
| 4962 | 4962 | EnvVar.ZIG_BTRFS_WORKAROUND.isSet(); |
| 4963 | var color: Color = .auto; | |
| 4963 | const color: Color = .auto; | |
| 4964 | 4964 | |
| 4965 | 4965 | // We want to release all the locks before executing the child process, so we make a nice |
| 4966 | 4966 | // big block here to ensure the cleanup gets run when we extract out our argv. |
| ... | ... | @@ -6001,7 +6001,7 @@ const ArgIteratorResponseFile = process.ArgIteratorGeneral(.{ .comments = true, |
| 6001 | 6001 | /// Initialize the arguments from a Response File. "*.rsp" |
| 6002 | 6002 | fn initArgIteratorResponseFile(allocator: Allocator, resp_file_path: []const u8) !ArgIteratorResponseFile { |
| 6003 | 6003 | const max_bytes = 10 * 1024 * 1024; // 10 MiB of command line arguments is a reasonable limit |
| 6004 | var cmd_line = try fs.cwd().readFileAlloc(allocator, resp_file_path, max_bytes); | |
| 6004 | const cmd_line = try fs.cwd().readFileAlloc(allocator, resp_file_path, max_bytes); | |
| 6005 | 6005 | errdefer allocator.free(cmd_line); |
| 6006 | 6006 | |
| 6007 | 6007 | return ArgIteratorResponseFile.initTakeOwnership(allocator, cmd_line); |
src/resinator/bmp.zig+1-1| ... | ... | @@ -120,7 +120,7 @@ pub fn read(reader: anytype, max_size: u64) ReadError!BitmapInfo { |
| 120 | 120 | var dib_header_buf: [@sizeOf(BITMAPCOREHEADER)]u8 align(@alignOf(BITMAPCOREHEADER)) = undefined; |
| 121 | 121 | std.mem.writeInt(u32, dib_header_buf[0..4], bitmap_info.dib_header_size, .little); |
| 122 | 122 | reader.readNoEof(dib_header_buf[4..]) catch return error.UnexpectedEOF; |
| 123 | var dib_header: *BITMAPCOREHEADER = @ptrCast(&dib_header_buf); | |
| 123 | const dib_header: *BITMAPCOREHEADER = @ptrCast(&dib_header_buf); | |
| 124 | 124 | structFieldsLittleToNative(BITMAPCOREHEADER, dib_header); |
| 125 | 125 | |
| 126 | 126 | // > The size of the color palette is calculated from the BitsPerPixel value. |
src/resinator/cli.zig+5-5| ... | ... | @@ -163,15 +163,15 @@ pub const Options = struct { |
| 163 | 163 | // we shouldn't change anything. |
| 164 | 164 | if (val_ptr.* == .undefine) return; |
| 165 | 165 | // Otherwise, the new value takes precedence. |
| 166 | var duped_value = try self.allocator.dupe(u8, value); | |
| 166 | const duped_value = try self.allocator.dupe(u8, value); | |
| 167 | 167 | errdefer self.allocator.free(duped_value); |
| 168 | 168 | val_ptr.deinit(self.allocator); |
| 169 | 169 | val_ptr.* = .{ .define = duped_value }; |
| 170 | 170 | return; |
| 171 | 171 | } |
| 172 | var duped_key = try self.allocator.dupe(u8, identifier); | |
| 172 | const duped_key = try self.allocator.dupe(u8, identifier); | |
| 173 | 173 | errdefer self.allocator.free(duped_key); |
| 174 | var duped_value = try self.allocator.dupe(u8, value); | |
| 174 | const duped_value = try self.allocator.dupe(u8, value); | |
| 175 | 175 | errdefer self.allocator.free(duped_value); |
| 176 | 176 | try self.symbols.put(self.allocator, duped_key, .{ .define = duped_value }); |
| 177 | 177 | } |
| ... | ... | @@ -183,7 +183,7 @@ pub const Options = struct { |
| 183 | 183 | action.* = .{ .undefine = {} }; |
| 184 | 184 | return; |
| 185 | 185 | } |
| 186 | var duped_key = try self.allocator.dupe(u8, identifier); | |
| 186 | const duped_key = try self.allocator.dupe(u8, identifier); | |
| 187 | 187 | errdefer self.allocator.free(duped_key); |
| 188 | 188 | try self.symbols.put(self.allocator, duped_key, .{ .undefine = {} }); |
| 189 | 189 | } |
| ... | ... | @@ -828,7 +828,7 @@ pub fn parse(allocator: Allocator, args: []const []const u8, diagnostics: *Diagn |
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | var positionals = args[arg_i..]; | |
| 831 | const positionals = args[arg_i..]; | |
| 832 | 832 | |
| 833 | 833 | if (positionals.len < 1) { |
| 834 | 834 | var err_details = Diagnostics.ErrorDetails{ .print_args = false, .arg_index = arg_i }; |
src/resinator/code_pages.zig+3-3| ... | ... | @@ -302,8 +302,8 @@ pub const Utf8 = struct { |
| 302 | 302 | |
| 303 | 303 | pub fn decode(bytes: []const u8) Codepoint { |
| 304 | 304 | std.debug.assert(bytes.len > 0); |
| 305 | var first_byte = bytes[0]; | |
| 306 | var expected_len = sequenceLength(first_byte) orelse { | |
| 305 | const first_byte = bytes[0]; | |
| 306 | const expected_len = sequenceLength(first_byte) orelse { | |
| 307 | 307 | return .{ .value = Codepoint.invalid, .byte_len = 1 }; |
| 308 | 308 | }; |
| 309 | 309 | if (expected_len == 1) return .{ .value = first_byte, .byte_len = 1 }; |
| ... | ... | @@ -367,7 +367,7 @@ pub const Utf8 = struct { |
| 367 | 367 | |
| 368 | 368 | test "Utf8.WellFormedDecoder" { |
| 369 | 369 | const invalid_utf8 = "\xF0\x80"; |
| 370 | var decoded = Utf8.WellFormedDecoder.decode(invalid_utf8); | |
| 370 | const decoded = Utf8.WellFormedDecoder.decode(invalid_utf8); | |
| 371 | 371 | try std.testing.expectEqual(Codepoint.invalid, decoded.value); |
| 372 | 372 | try std.testing.expectEqual(@as(usize, 2), decoded.byte_len); |
| 373 | 373 | } |
src/resinator/comments.zig+4-4| ... | ... | @@ -206,9 +206,9 @@ inline fn handleMultilineCarriageReturn( |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | pub fn removeCommentsAlloc(allocator: Allocator, source: []const u8, source_mappings: ?*SourceMappings) ![]u8 { |
| 209 | var buf = try allocator.alloc(u8, source.len); | |
| 209 | const buf = try allocator.alloc(u8, source.len); | |
| 210 | 210 | errdefer allocator.free(buf); |
| 211 | var result = removeComments(source, buf, source_mappings); | |
| 211 | const result = removeComments(source, buf, source_mappings); | |
| 212 | 212 | return allocator.realloc(buf, result.len); |
| 213 | 213 | } |
| 214 | 214 | |
| ... | ... | @@ -326,7 +326,7 @@ test "remove comments with mappings" { |
| 326 | 326 | try mappings.set(allocator, 3, .{ .start_line = 3, .end_line = 3, .filename_offset = 0 }); |
| 327 | 327 | defer mappings.deinit(allocator); |
| 328 | 328 | |
| 329 | var result = removeComments(&mut_source, &mut_source, &mappings); | |
| 329 | const result = removeComments(&mut_source, &mut_source, &mappings); | |
| 330 | 330 | |
| 331 | 331 | try std.testing.expectEqualStrings("blahblah", result); |
| 332 | 332 | try std.testing.expectEqual(@as(usize, 1), mappings.mapping.items.len); |
| ... | ... | @@ -335,6 +335,6 @@ test "remove comments with mappings" { |
| 335 | 335 | |
| 336 | 336 | test "in place" { |
| 337 | 337 | var mut_source = "blah /* comment */ blah".*; |
| 338 | var result = removeComments(&mut_source, &mut_source, null); | |
| 338 | const result = removeComments(&mut_source, &mut_source, null); | |
| 339 | 339 | try std.testing.expectEqualStrings("blah blah", result); |
| 340 | 340 | } |
src/resinator/compile.zig+4-4| ... | ... | @@ -666,7 +666,7 @@ pub const Compiler = struct { |
| 666 | 666 | }, |
| 667 | 667 | }, |
| 668 | 668 | .dib => { |
| 669 | var bitmap_header: *ico.BitmapHeader = @ptrCast(@alignCast(&header_bytes)); | |
| 669 | const bitmap_header: *ico.BitmapHeader = @ptrCast(@alignCast(&header_bytes)); | |
| 670 | 670 | if (native_endian == .big) { |
| 671 | 671 | std.mem.byteSwapAllFields(ico.BitmapHeader, bitmap_header); |
| 672 | 672 | } |
| ... | ... | @@ -1773,13 +1773,13 @@ pub const Compiler = struct { |
| 1773 | 1773 | } |
| 1774 | 1774 | try data_writer.writeByteNTimes(0, num_padding); |
| 1775 | 1775 | |
| 1776 | var style = if (control.style) |style_expression| | |
| 1776 | const style = if (control.style) |style_expression| | |
| 1777 | 1777 | // Certain styles are implied by the control type |
| 1778 | 1778 | evaluateFlagsExpressionWithDefault(res.ControlClass.getImpliedStyle(control_type), style_expression, self.source, self.input_code_pages) |
| 1779 | 1779 | else |
| 1780 | 1780 | res.ControlClass.getImpliedStyle(control_type); |
| 1781 | 1781 | |
| 1782 | var exstyle = if (control.exstyle) |exstyle_expression| | |
| 1782 | const exstyle = if (control.exstyle) |exstyle_expression| | |
| 1783 | 1783 | evaluateFlagsExpressionWithDefault(0, exstyle_expression, self.source, self.input_code_pages) |
| 1784 | 1784 | else |
| 1785 | 1785 | 0; |
| ... | ... | @@ -3205,7 +3205,7 @@ pub const StringTable = struct { |
| 3205 | 3205 | const trimmed_string = trim: { |
| 3206 | 3206 | // Two NUL characters in a row act as a terminator |
| 3207 | 3207 | // Note: This is only the case for STRINGTABLE strings |
| 3208 | var trimmed = trimToDoubleNUL(u16, utf16_string); | |
| 3208 | const trimmed = trimToDoubleNUL(u16, utf16_string); | |
| 3209 | 3209 | // We also want to trim any trailing NUL characters |
| 3210 | 3210 | break :trim std.mem.trimRight(u16, trimmed, &[_]u16{0}); |
| 3211 | 3211 | }; |
src/resinator/lang.zig+1-1| ... | ... | @@ -98,7 +98,7 @@ pub fn tagToId(tag: []const u8) error{InvalidLanguageTag}!?LanguageId { |
| 98 | 98 | var normalized_buf: [longest_known_tag]u8 = undefined; |
| 99 | 99 | // To allow e.g. `de-de_phoneb` to get looked up as `de-de`, we need to |
| 100 | 100 | // omit the suffix, but only if the tag contains a valid alternate sort order. |
| 101 | var tag_to_normalize = if (parsed.isSuffixValidSortOrder()) tag[0 .. tag.len - (parsed.suffix.?.len + 1)] else tag; | |
| 101 | const tag_to_normalize = if (parsed.isSuffixValidSortOrder()) tag[0 .. tag.len - (parsed.suffix.?.len + 1)] else tag; | |
| 102 | 102 | const normalized_tag = normalizeTag(tag_to_normalize, &normalized_buf); |
| 103 | 103 | return std.meta.stringToEnum(LanguageId, normalized_tag) orelse { |
| 104 | 104 | // special case for a tag that has been mapped to the same ID |
src/resinator/parse.zig+6-6| ... | ... | @@ -100,7 +100,7 @@ pub const Parser = struct { |
| 100 | 100 | // because it almost always leads to unhelpful error messages |
| 101 | 101 | // (usually it will end up with bogus things like 'file |
| 102 | 102 | // not found: {') |
| 103 | var statement = try self.parseStatement(); | |
| 103 | const statement = try self.parseStatement(); | |
| 104 | 104 | try statements.append(statement); |
| 105 | 105 | } |
| 106 | 106 | } |
| ... | ... | @@ -698,7 +698,7 @@ pub const Parser = struct { |
| 698 | 698 | .dlginclude => { |
| 699 | 699 | const common_resource_attributes = try self.parseCommonResourceAttributes(); |
| 700 | 700 | |
| 701 | var filename_expression = try self.parseExpression(.{ | |
| 701 | const filename_expression = try self.parseExpression(.{ | |
| 702 | 702 | .allowed_types = .{ .string = true }, |
| 703 | 703 | }); |
| 704 | 704 | |
| ... | ... | @@ -756,7 +756,7 @@ pub const Parser = struct { |
| 756 | 756 | return &node.base; |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | var filename_expression = try self.parseExpression(.{ | |
| 759 | const filename_expression = try self.parseExpression(.{ | |
| 760 | 760 | // Don't tell the user that numbers are accepted since we error on |
| 761 | 761 | // number expressions and regular number literals are treated as unquoted |
| 762 | 762 | // literals rather than numbers, so from the users perspective |
| ... | ... | @@ -934,8 +934,8 @@ pub const Parser = struct { |
| 934 | 934 | style = try optional_param_parser.parse(.{ .not_expression_allowed = true }); |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | var exstyle: ?*Node = try optional_param_parser.parse(.{ .not_expression_allowed = true }); | |
| 938 | var help_id: ?*Node = switch (resource) { | |
| 937 | const exstyle: ?*Node = try optional_param_parser.parse(.{ .not_expression_allowed = true }); | |
| 938 | const help_id: ?*Node = switch (resource) { | |
| 939 | 939 | .dialogex => try optional_param_parser.parse(.{}), |
| 940 | 940 | else => null, |
| 941 | 941 | }; |
| ... | ... | @@ -1526,7 +1526,7 @@ pub const Parser = struct { |
| 1526 | 1526 | |
| 1527 | 1527 | pub fn toErrorDetails(options: ParseExpressionOptions, token: Token) ErrorDetails { |
| 1528 | 1528 | // TODO: expected_types_override interaction with is_known_to_be_number_expression? |
| 1529 | var expected_types = options.expected_types_override orelse ErrorDetails.ExpectedTypes{ | |
| 1529 | const expected_types = options.expected_types_override orelse ErrorDetails.ExpectedTypes{ | |
| 1530 | 1530 | .number = options.allowed_types.number, |
| 1531 | 1531 | .number_expression = options.allowed_types.number, |
| 1532 | 1532 | .string_literal = options.allowed_types.string and !options.is_known_to_be_number_expression, |
src/resinator/res.zig+2-2| ... | ... | @@ -357,7 +357,7 @@ pub const NameOrOrdinal = union(enum) { |
| 357 | 357 | /// RC compiler would have allowed them, so that a proper warning/error |
| 358 | 358 | /// can be emitted. |
| 359 | 359 | pub fn maybeNonAsciiOrdinalFromString(bytes: SourceBytes) ?NameOrOrdinal { |
| 360 | var buf = bytes.slice; | |
| 360 | const buf = bytes.slice; | |
| 361 | 361 | const radix = 10; |
| 362 | 362 | if (buf.len > 2 and buf[0] == '0') { |
| 363 | 363 | switch (buf[1]) { |
| ... | ... | @@ -514,7 +514,7 @@ test "NameOrOrdinal" { |
| 514 | 514 | { |
| 515 | 515 | var expected = blk: { |
| 516 | 516 | // the input before the 𐐷 character, but uppercased |
| 517 | var expected_u8_bytes = "00614982008907933748980730280674788429543776231864944218790698304852300002973622122844631429099469274282385299397783838528QFFL7SHNSIETG0QKLR1UYPBTUV1PMFQRRA0VJDG354GQEDJMUPGPP1W1EXVNTZVEIZ6K3IPQM1AWGEYALMEODYVEZGOD3MFMGEY8FNR4JUETTB1PZDEWSNDRGZUA8SNXP3NGO"; | |
| 517 | const expected_u8_bytes = "00614982008907933748980730280674788429543776231864944218790698304852300002973622122844631429099469274282385299397783838528QFFL7SHNSIETG0QKLR1UYPBTUV1PMFQRRA0VJDG354GQEDJMUPGPP1W1EXVNTZVEIZ6K3IPQM1AWGEYALMEODYVEZGOD3MFMGEY8FNR4JUETTB1PZDEWSNDRGZUA8SNXP3NGO"; | |
| 518 | 518 | var buf: [256:0]u16 = undefined; |
| 519 | 519 | for (expected_u8_bytes, 0..) |byte, i| { |
| 520 | 520 | buf[i] = std.mem.nativeToLittle(u16, byte); |
src/resinator/source_mapping.zig+2-2| ... | ... | @@ -251,7 +251,7 @@ pub fn handleLineCommand(allocator: Allocator, line_command: []const u8, current |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | pub fn parseAndRemoveLineCommandsAlloc(allocator: Allocator, source: []const u8, options: ParseAndRemoveLineCommandsOptions) !ParseLineCommandsResult { |
| 254 | var buf = try allocator.alloc(u8, source.len); | |
| 254 | const buf = try allocator.alloc(u8, source.len); | |
| 255 | 255 | errdefer allocator.free(buf); |
| 256 | 256 | var result = try parseAndRemoveLineCommands(allocator, source, buf, options); |
| 257 | 257 | result.result = try allocator.realloc(buf, result.result.len); |
| ... | ... | @@ -440,7 +440,7 @@ pub const SourceMappings = struct { |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | pub fn set(self: *SourceMappings, allocator: Allocator, line_num: usize, span: SourceSpan) !void { |
| 443 | var ptr = try self.expandAndGet(allocator, line_num); | |
| 443 | const ptr = try self.expandAndGet(allocator, line_num); | |
| 444 | 444 | ptr.* = span; |
| 445 | 445 | } |
| 446 | 446 |
src/translate_c.zig+5-5| ... | ... | @@ -456,7 +456,7 @@ fn visitFnDecl(c: *Context, fn_decl: *const clang.FunctionDecl) Error!void { |
| 456 | 456 | block_scope.return_type = return_qt; |
| 457 | 457 | defer block_scope.deinit(); |
| 458 | 458 | |
| 459 | var scope = &block_scope.base; | |
| 459 | const scope = &block_scope.base; | |
| 460 | 460 | |
| 461 | 461 | var param_id: c_uint = 0; |
| 462 | 462 | for (proto_node.data.params) |*param| { |
| ... | ... | @@ -1363,7 +1363,7 @@ fn transSimpleOffsetOfExpr(c: *Context, expr: *const clang.OffsetOfExpr) TransEr |
| 1363 | 1363 | if (c.decl_table.get(@intFromPtr(record_decl.getCanonicalDecl()))) |type_name| { |
| 1364 | 1364 | const type_node = try Tag.type.create(c.arena, type_name); |
| 1365 | 1365 | |
| 1366 | var raw_field_name = try c.str(@as(*const clang.NamedDecl, @ptrCast(field_decl)).getName_bytes_begin()); | |
| 1366 | const raw_field_name = try c.str(@as(*const clang.NamedDecl, @ptrCast(field_decl)).getName_bytes_begin()); | |
| 1367 | 1367 | const quoted_field_name = try std.fmt.allocPrint(c.arena, "\"{s}\"", .{raw_field_name}); |
| 1368 | 1368 | const field_name_node = try Tag.string_literal.create(c.arena, quoted_field_name); |
| 1369 | 1369 | |
| ... | ... | @@ -1967,7 +1967,7 @@ fn transBoolExpr( |
| 1967 | 1967 | return Node{ .tag_if_small_enough = @intFromEnum(([2]Tag{ .true_literal, .false_literal })[@intFromBool(is_zero)]) }; |
| 1968 | 1968 | } |
| 1969 | 1969 | |
| 1970 | var res = try transExpr(c, scope, expr, used); | |
| 1970 | const res = try transExpr(c, scope, expr, used); | |
| 1971 | 1971 | if (isBoolRes(res)) { |
| 1972 | 1972 | return maybeSuppressResult(c, used, res); |
| 1973 | 1973 | } |
| ... | ... | @@ -3477,7 +3477,7 @@ fn cIsFunctionDeclRef(expr: *const clang.Expr) bool { |
| 3477 | 3477 | |
| 3478 | 3478 | fn transCallExpr(c: *Context, scope: *Scope, stmt: *const clang.CallExpr, result_used: ResultUsed) TransError!Node { |
| 3479 | 3479 | const callee = stmt.getCallee(); |
| 3480 | var raw_fn_expr = try transExpr(c, scope, callee, .used); | |
| 3480 | const raw_fn_expr = try transExpr(c, scope, callee, .used); | |
| 3481 | 3481 | |
| 3482 | 3482 | var is_ptr = false; |
| 3483 | 3483 | const fn_ty = qualTypeGetFnProto(callee.getType(), &is_ptr); |
| ... | ... | @@ -5889,7 +5889,7 @@ fn escapeUnprintables(ctx: *Context, m: *MacroCtx) ![]const u8 { |
| 5889 | 5889 | |
| 5890 | 5890 | const formatter = std.fmt.fmtSliceEscapeLower(zigified); |
| 5891 | 5891 | const encoded_size = @as(usize, @intCast(std.fmt.count("{s}", .{formatter}))); |
| 5892 | var output = try ctx.arena.alloc(u8, encoded_size); | |
| 5892 | const output = try ctx.arena.alloc(u8, encoded_size); | |
| 5893 | 5893 | return std.fmt.bufPrint(output, "{s}", .{formatter}) catch |err| switch (err) { |
| 5894 | 5894 | error.NoSpaceLeft => unreachable, |
| 5895 | 5895 | else => |e| return e, |
src/value.zig+3-3| ... | ... | @@ -2136,7 +2136,7 @@ pub const Value = struct { |
| 2136 | 2136 | lhs_bigint.limbs.len + rhs_bigint.limbs.len, |
| 2137 | 2137 | ); |
| 2138 | 2138 | var result_bigint = BigIntMutable{ .limbs = limbs, .positive = undefined, .len = undefined }; |
| 2139 | var limbs_buffer = try arena.alloc( | |
| 2139 | const limbs_buffer = try arena.alloc( | |
| 2140 | 2140 | std.math.big.Limb, |
| 2141 | 2141 | std.math.big.int.calcMulLimbsBufferLen(lhs_bigint.limbs.len, rhs_bigint.limbs.len, 1), |
| 2142 | 2142 | ); |
| ... | ... | @@ -2249,7 +2249,7 @@ pub const Value = struct { |
| 2249 | 2249 | ), |
| 2250 | 2250 | ); |
| 2251 | 2251 | var result_bigint = BigIntMutable{ .limbs = limbs, .positive = undefined, .len = undefined }; |
| 2252 | var limbs_buffer = try arena.alloc( | |
| 2252 | const limbs_buffer = try arena.alloc( | |
| 2253 | 2253 | std.math.big.Limb, |
| 2254 | 2254 | std.math.big.int.calcMulLimbsBufferLen(lhs_bigint.limbs.len, rhs_bigint.limbs.len, 1), |
| 2255 | 2255 | ); |
| ... | ... | @@ -2788,7 +2788,7 @@ pub const Value = struct { |
| 2788 | 2788 | lhs_bigint.limbs.len + rhs_bigint.limbs.len, |
| 2789 | 2789 | ); |
| 2790 | 2790 | var result_bigint = BigIntMutable{ .limbs = limbs, .positive = undefined, .len = undefined }; |
| 2791 | var limbs_buffer = try allocator.alloc( | |
| 2791 | const limbs_buffer = try allocator.alloc( | |
| 2792 | 2792 | std.math.big.Limb, |
| 2793 | 2793 | std.math.big.int.calcMulLimbsBufferLen(lhs_bigint.limbs.len, rhs_bigint.limbs.len, 1), |
| 2794 | 2794 | ); |
src/windows_sdk.zig+9-9| ... | ... | @@ -69,7 +69,7 @@ fn iterateAndFilterBySemVer(iterator: *std.fs.IterableDir.Iterator, allocator: s |
| 69 | 69 | try dirs_filtered_list.append(subfolder_name_allocated); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | var dirs_filtered_slice = try dirs_filtered_list.toOwnedSlice(); | |
| 72 | const dirs_filtered_slice = try dirs_filtered_list.toOwnedSlice(); | |
| 73 | 73 | // Keep in mind that order of these names is not guaranteed by Windows, |
| 74 | 74 | // so we cannot just reverse or "while (popOrNull())" this ArrayList. |
| 75 | 75 | std.mem.sortUnstable([]const u8, dirs_filtered_slice, {}, struct { |
| ... | ... | @@ -129,7 +129,7 @@ const RegistryUtf8 = struct { |
| 129 | 129 | const value_utf16le = try registry_utf16le.getString(allocator, subkey_utf16le, value_name_utf16le); |
| 130 | 130 | defer allocator.free(value_utf16le); |
| 131 | 131 | |
| 132 | var value_utf8: []u8 = std.unicode.utf16leToUtf8Alloc(allocator, value_utf16le) catch |err| switch (err) { | |
| 132 | const value_utf8: []u8 = std.unicode.utf16leToUtf8Alloc(allocator, value_utf16le) catch |err| switch (err) { | |
| 133 | 133 | error.OutOfMemory => return error.OutOfMemory, |
| 134 | 134 | else => return error.StringNotFound, |
| 135 | 135 | }; |
| ... | ... | @@ -246,7 +246,7 @@ const RegistryUtf16Le = struct { |
| 246 | 246 | else => return error.NotAString, |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | var value_utf16le_buf: []u16 = try allocator.alloc(u16, std.math.divCeil(u32, value_utf16le_buf_size, 2) catch unreachable); | |
| 249 | const value_utf16le_buf: []u16 = try allocator.alloc(u16, std.math.divCeil(u32, value_utf16le_buf_size, 2) catch unreachable); | |
| 250 | 250 | errdefer allocator.free(value_utf16le_buf); |
| 251 | 251 | |
| 252 | 252 | return_code_int = windows.advapi32.RegGetValueW( |
| ... | ... | @@ -354,7 +354,7 @@ pub const Windows10Sdk = struct { |
| 354 | 354 | defer v10_key.closeKey(); |
| 355 | 355 | |
| 356 | 356 | const path: []const u8 = path10: { |
| 357 | var path_maybe_with_trailing_slash = v10_key.getString(allocator, "", "InstallationFolder") catch |err| switch (err) { | |
| 357 | const path_maybe_with_trailing_slash = v10_key.getString(allocator, "", "InstallationFolder") catch |err| switch (err) { | |
| 358 | 358 | error.NotAString => return error.Windows10SdkNotFound, |
| 359 | 359 | error.ValueNameNotFound => return error.Windows10SdkNotFound, |
| 360 | 360 | error.StringNotFound => return error.Windows10SdkNotFound, |
| ... | ... | @@ -381,7 +381,7 @@ pub const Windows10Sdk = struct { |
| 381 | 381 | const version: []const u8 = version10: { |
| 382 | 382 | |
| 383 | 383 | // note(dimenus): Microsoft doesn't include the .0 in the ProductVersion key.... |
| 384 | var version_without_0 = v10_key.getString(allocator, "", "ProductVersion") catch |err| switch (err) { | |
| 384 | const version_without_0 = v10_key.getString(allocator, "", "ProductVersion") catch |err| switch (err) { | |
| 385 | 385 | error.NotAString => return error.Windows10SdkNotFound, |
| 386 | 386 | error.ValueNameNotFound => return error.Windows10SdkNotFound, |
| 387 | 387 | error.StringNotFound => return error.Windows10SdkNotFound, |
| ... | ... | @@ -445,7 +445,7 @@ pub const Windows81Sdk = struct { |
| 445 | 445 | /// After finishing work, call `free(allocator)`. |
| 446 | 446 | fn find(allocator: std.mem.Allocator, roots_key: *const RegistryUtf8) error{ OutOfMemory, Windows81SdkNotFound, PathTooLong, VersionTooLong }!Windows81Sdk { |
| 447 | 447 | const path: []const u8 = path81: { |
| 448 | var path_maybe_with_trailing_slash = roots_key.getString(allocator, "", "KitsRoot81") catch |err| switch (err) { | |
| 448 | const path_maybe_with_trailing_slash = roots_key.getString(allocator, "", "KitsRoot81") catch |err| switch (err) { | |
| 449 | 449 | error.NotAString => return error.Windows81SdkNotFound, |
| 450 | 450 | error.ValueNameNotFound => return error.Windows81SdkNotFound, |
| 451 | 451 | error.StringNotFound => return error.Windows81SdkNotFound, |
| ... | ... | @@ -752,7 +752,7 @@ const MsvcLibDir = struct { |
| 752 | 752 | |
| 753 | 753 | const config_subkey = std.fmt.bufPrint(config_subkey_buf[0..], "Software\\Microsoft\\VisualStudio\\{s}_Config", .{vs_version}) catch unreachable; |
| 754 | 754 | |
| 755 | var source_directories_value = visualstudio_registry.getString(allocator, config_subkey, "Source Directories") catch |err| switch (err) { | |
| 755 | const source_directories_value = visualstudio_registry.getString(allocator, config_subkey, "Source Directories") catch |err| switch (err) { | |
| 756 | 756 | error.OutOfMemory => return error.OutOfMemory, |
| 757 | 757 | else => continue, |
| 758 | 758 | }; |
| ... | ... | @@ -768,7 +768,7 @@ const MsvcLibDir = struct { |
| 768 | 768 | var source_directories_splitted = std.mem.splitScalar(u8, source_directories, ';'); |
| 769 | 769 | |
| 770 | 770 | const msvc_dir: []const u8 = msvc_dir: { |
| 771 | var msvc_include_dir_maybe_with_trailing_slash = try allocator.dupe(u8, source_directories_splitted.first()); | |
| 771 | const msvc_include_dir_maybe_with_trailing_slash = try allocator.dupe(u8, source_directories_splitted.first()); | |
| 772 | 772 | |
| 773 | 773 | if (msvc_include_dir_maybe_with_trailing_slash.len > std.fs.MAX_PATH_BYTES or !std.fs.path.isAbsolute(msvc_include_dir_maybe_with_trailing_slash)) { |
| 774 | 774 | allocator.free(msvc_include_dir_maybe_with_trailing_slash); |
| ... | ... | @@ -833,7 +833,7 @@ const MsvcLibDir = struct { |
| 833 | 833 | const vs7_key = RegistryUtf8.openKey("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7") catch return error.PathNotFound; |
| 834 | 834 | defer vs7_key.closeKey(); |
| 835 | 835 | try_vs7_key: { |
| 836 | var path_maybe_with_trailing_slash = vs7_key.getString(allocator, "", "14.0") catch |err| switch (err) { | |
| 836 | const path_maybe_with_trailing_slash = vs7_key.getString(allocator, "", "14.0") catch |err| switch (err) { | |
| 837 | 837 | error.OutOfMemory => return error.OutOfMemory, |
| 838 | 838 | else => break :try_vs7_key, |
| 839 | 839 | }; |