@zigc/lib 0.17.0-dev.27 → 0.17.0-dev.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/c/fcntl.zig +1 -1
- package/compiler/build_runner.zig +0 -2
- package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
- package/package.json +1 -1
- package/std/Build/Step/Compile.zig +0 -1
- package/std/Build.zig +0 -3
- package/std/Io/Threaded.zig +8 -8
- package/std/Io/Writer.zig +7 -3
- package/std/os/linux/aarch64.zig +41 -12
- package/std/os/linux/arc.zig +41 -12
- package/std/os/linux/arm.zig +41 -12
- package/std/os/linux/hexagon.zig +33 -11
- package/std/os/linux/loongarch32.zig +41 -13
- package/std/os/linux/loongarch64.zig +41 -12
- package/std/os/linux/m68k.zig +41 -13
- package/std/os/linux/mips.zig +67 -36
- package/std/os/linux/mips64.zig +60 -29
- package/std/os/linux/mipsn32.zig +60 -29
- package/std/os/linux/or1k.zig +41 -12
- package/std/os/linux/powerpc.zig +41 -12
- package/std/os/linux/powerpc64.zig +41 -12
- package/std/os/linux/riscv32.zig +41 -12
- package/std/os/linux/riscv64.zig +41 -12
- package/std/os/linux/s390x.zig +44 -7
- package/std/os/linux/sparc64.zig +83 -52
- package/std/os/linux/thumb.zig +52 -36
- package/std/os/linux/x32.zig +41 -12
- package/std/os/linux/x86.zig +42 -13
- package/std/os/linux/x86_64.zig +41 -12
- package/std/os/linux.zig +386 -432
- package/std/zig/AstGen.zig +1 -74
- package/std/zig/AstRlAnnotate.zig +0 -11
- package/std/zig/BuiltinFn.zig +0 -32
- package/std/zig/Zir.zig +50 -63
- package/std/zig.zig +0 -10
package/std/zig/AstGen.zig
CHANGED
|
@@ -2870,7 +2870,6 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As
|
|
|
2870
2870
|
.mul_add,
|
|
2871
2871
|
.max,
|
|
2872
2872
|
.min,
|
|
2873
|
-
.c_import,
|
|
2874
2873
|
.@"resume",
|
|
2875
2874
|
.ret_err_value_code,
|
|
2876
2875
|
.ret_ptr,
|
|
@@ -8955,7 +8954,6 @@ fn typeOf(
|
|
|
8955
8954
|
var typeof_scope = gz.makeSubBlock(scope);
|
|
8956
8955
|
typeof_scope.is_comptime = false;
|
|
8957
8956
|
typeof_scope.is_typeof = true;
|
|
8958
|
-
typeof_scope.c_import = false;
|
|
8959
8957
|
defer typeof_scope.unstack();
|
|
8960
8958
|
|
|
8961
8959
|
const ty_expr = try reachableExpr(&typeof_scope, &typeof_scope.base, .{ .rl = .none }, args[0], node);
|
|
@@ -9055,8 +9053,7 @@ fn builtinCall(
|
|
|
9055
9053
|
const builtin_name = tree.tokenSlice(builtin_token);
|
|
9056
9054
|
|
|
9057
9055
|
// We handle the different builtins manually because they have different semantics depending
|
|
9058
|
-
// on the function. For example, `@as` and others participate in result location semantics
|
|
9059
|
-
// and `@cImport` creates a special scope that collects a .c source code text buffer.
|
|
9056
|
+
// on the function. For example, `@as` and others participate in result location semantics.
|
|
9060
9057
|
// Also, some builtins have a variable number of parameters.
|
|
9061
9058
|
|
|
9062
9059
|
const info = BuiltinFn.list.get(builtin_name) orelse {
|
|
@@ -9175,7 +9172,6 @@ fn builtinCall(
|
|
|
9175
9172
|
.bit_cast => return bitCast( gz, scope, ri, node, params[0]),
|
|
9176
9173
|
.TypeOf => return typeOf( gz, scope, ri, node, params),
|
|
9177
9174
|
.union_init => return unionInit(gz, scope, ri, node, params),
|
|
9178
|
-
.c_import => return cImport( gz, scope, node, params[0]),
|
|
9179
9175
|
.min => return minMax( gz, scope, ri, node, params, .min),
|
|
9180
9176
|
.max => return minMax( gz, scope, ri, node, params, .max),
|
|
9181
9177
|
// zig fmt: on
|
|
@@ -9484,9 +9480,6 @@ fn builtinCall(
|
|
|
9484
9480
|
.bit_offset_of => return offsetOf(gz, scope, ri, node, params[0], params[1], .bit_offset_of),
|
|
9485
9481
|
.offset_of => return offsetOf(gz, scope, ri, node, params[0], params[1], .offset_of),
|
|
9486
9482
|
|
|
9487
|
-
.c_undef => return simpleCBuiltin(gz, scope, ri, node, params[0], .c_undef),
|
|
9488
|
-
.c_include => return simpleCBuiltin(gz, scope, ri, node, params[0], .c_include),
|
|
9489
|
-
|
|
9490
9483
|
.cmpxchg_strong => return cmpxchg(gz, scope, ri, node, params, 1),
|
|
9491
9484
|
.cmpxchg_weak => return cmpxchg(gz, scope, ri, node, params, 0),
|
|
9492
9485
|
// zig fmt: on
|
|
@@ -9509,17 +9502,6 @@ fn builtinCall(
|
|
|
9509
9502
|
});
|
|
9510
9503
|
return rvalue(gz, ri, result, node);
|
|
9511
9504
|
},
|
|
9512
|
-
.c_define => {
|
|
9513
|
-
if (!gz.c_import) return gz.astgen.failNode(node, "C define valid only inside C import block", .{});
|
|
9514
|
-
const name = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_u8_type } }, params[0], .operand_cDefine_macro_name);
|
|
9515
|
-
const value = try comptimeExpr(gz, scope, .{ .rl = .none }, params[1], .operand_cDefine_macro_value);
|
|
9516
|
-
const result = try gz.addExtendedPayload(.c_define, Zir.Inst.BinNode{
|
|
9517
|
-
.node = gz.nodeIndexToRelative(node),
|
|
9518
|
-
.lhs = name,
|
|
9519
|
-
.rhs = value,
|
|
9520
|
-
});
|
|
9521
|
-
return rvalue(gz, ri, result, node);
|
|
9522
|
-
},
|
|
9523
9505
|
.splat => {
|
|
9524
9506
|
const result_type = try ri.rl.resultTypeForCast(gz, node, builtin_name);
|
|
9525
9507
|
const elem_type = try gz.addUnNode(.splat_op_result_ty, result_type, node);
|
|
@@ -9951,30 +9933,6 @@ fn divBuiltin(
|
|
|
9951
9933
|
return rvalue(gz, ri, result, node);
|
|
9952
9934
|
}
|
|
9953
9935
|
|
|
9954
|
-
fn simpleCBuiltin(
|
|
9955
|
-
gz: *GenZir,
|
|
9956
|
-
scope: *Scope,
|
|
9957
|
-
ri: ResultInfo,
|
|
9958
|
-
node: Ast.Node.Index,
|
|
9959
|
-
operand_node: Ast.Node.Index,
|
|
9960
|
-
tag: Zir.Inst.Extended,
|
|
9961
|
-
) InnerError!Zir.Inst.Ref {
|
|
9962
|
-
const name: []const u8 = if (tag == .c_undef) "C undef" else "C include";
|
|
9963
|
-
if (!gz.c_import) return gz.astgen.failNode(node, "{s} valid only inside C import block", .{name});
|
|
9964
|
-
const operand = try comptimeExpr(
|
|
9965
|
-
gz,
|
|
9966
|
-
scope,
|
|
9967
|
-
.{ .rl = .{ .coerced_ty = .slice_const_u8_type } },
|
|
9968
|
-
operand_node,
|
|
9969
|
-
if (tag == .c_undef) .operand_cUndef_macro_name else .operand_cInclude_file_name,
|
|
9970
|
-
);
|
|
9971
|
-
_ = try gz.addExtendedPayload(tag, Zir.Inst.UnNode{
|
|
9972
|
-
.node = gz.nodeIndexToRelative(node),
|
|
9973
|
-
.operand = operand,
|
|
9974
|
-
});
|
|
9975
|
-
return rvalue(gz, ri, .void_value, node);
|
|
9976
|
-
}
|
|
9977
|
-
|
|
9978
9936
|
fn offsetOf(
|
|
9979
9937
|
gz: *GenZir,
|
|
9980
9938
|
scope: *Scope,
|
|
@@ -10024,35 +9982,6 @@ fn shiftOp(
|
|
|
10024
9982
|
return rvalue(gz, ri, result, node);
|
|
10025
9983
|
}
|
|
10026
9984
|
|
|
10027
|
-
fn cImport(
|
|
10028
|
-
gz: *GenZir,
|
|
10029
|
-
scope: *Scope,
|
|
10030
|
-
node: Ast.Node.Index,
|
|
10031
|
-
body_node: Ast.Node.Index,
|
|
10032
|
-
) InnerError!Zir.Inst.Ref {
|
|
10033
|
-
const astgen = gz.astgen;
|
|
10034
|
-
const gpa = astgen.gpa;
|
|
10035
|
-
|
|
10036
|
-
if (gz.c_import) return gz.astgen.failNode(node, "cannot nest @cImport", .{});
|
|
10037
|
-
|
|
10038
|
-
var block_scope = gz.makeSubBlock(scope);
|
|
10039
|
-
block_scope.is_comptime = true;
|
|
10040
|
-
block_scope.c_import = true;
|
|
10041
|
-
defer block_scope.unstack();
|
|
10042
|
-
|
|
10043
|
-
const block_inst = try gz.makeBlockInst(.c_import, node);
|
|
10044
|
-
const block_result = try fullBodyExpr(&block_scope, &block_scope.base, .{ .rl = .none }, body_node, .normal);
|
|
10045
|
-
_ = try gz.addUnNode(.ensure_result_used, block_result, node);
|
|
10046
|
-
if (!gz.refIsNoReturn(block_result)) {
|
|
10047
|
-
_ = try block_scope.addBreak(.break_inline, block_inst, .void_value);
|
|
10048
|
-
}
|
|
10049
|
-
try block_scope.setBlockBody(block_inst);
|
|
10050
|
-
// block_scope unstacked now, can add new instructions to gz
|
|
10051
|
-
try gz.instructions.append(gpa, block_inst);
|
|
10052
|
-
|
|
10053
|
-
return block_inst.toRef();
|
|
10054
|
-
}
|
|
10055
|
-
|
|
10056
9985
|
fn overflowArithmetic(
|
|
10057
9986
|
gz: *GenZir,
|
|
10058
9987
|
scope: *Scope,
|
|
@@ -11339,7 +11268,6 @@ const GenZir = struct {
|
|
|
11339
11268
|
/// This is set to true for a `GenZir` of a `block_inline`, indicating that
|
|
11340
11269
|
/// exits from this block should use `break_inline` rather than `break`.
|
|
11341
11270
|
is_inline: bool = false,
|
|
11342
|
-
c_import: bool = false,
|
|
11343
11271
|
/// The containing decl AST node.
|
|
11344
11272
|
decl_node_index: Ast.Node.Index,
|
|
11345
11273
|
/// The containing decl line index, absolute.
|
|
@@ -11427,7 +11355,6 @@ const GenZir = struct {
|
|
|
11427
11355
|
return .{
|
|
11428
11356
|
.is_comptime = gz.is_comptime,
|
|
11429
11357
|
.is_typeof = gz.is_typeof,
|
|
11430
|
-
.c_import = gz.c_import,
|
|
11431
11358
|
.decl_node_index = gz.decl_node_index,
|
|
11432
11359
|
.decl_line = gz.decl_line,
|
|
11433
11360
|
.parent = scope,
|
|
@@ -842,10 +842,6 @@ fn builtinCall(astrl: *AstRlAnnotate, block: ?*Block, ri: ResultInfo, node: Ast.
|
|
|
842
842
|
_ = try astrl.expr(args[2], block, ResultInfo.type_only);
|
|
843
843
|
return false;
|
|
844
844
|
},
|
|
845
|
-
.c_import => {
|
|
846
|
-
_ = try astrl.expr(args[0], block, ResultInfo.none);
|
|
847
|
-
return false;
|
|
848
|
-
},
|
|
849
845
|
.min, .max => {
|
|
850
846
|
for (args) |arg_node| {
|
|
851
847
|
_ = try astrl.expr(arg_node, block, ResultInfo.none);
|
|
@@ -907,8 +903,6 @@ fn builtinCall(astrl: *AstRlAnnotate, block: ?*Block, ri: ResultInfo, node: Ast.
|
|
|
907
903
|
.error_name,
|
|
908
904
|
.set_runtime_safety,
|
|
909
905
|
.Tuple,
|
|
910
|
-
.c_undef,
|
|
911
|
-
.c_include,
|
|
912
906
|
.wasm_memory_size,
|
|
913
907
|
.splat,
|
|
914
908
|
.set_float_mode,
|
|
@@ -986,11 +980,6 @@ fn builtinCall(astrl: *AstRlAnnotate, block: ?*Block, ri: ResultInfo, node: Ast.
|
|
|
986
980
|
_ = try astrl.expr(args[1], block, ResultInfo.type_only);
|
|
987
981
|
return false;
|
|
988
982
|
},
|
|
989
|
-
.c_define => {
|
|
990
|
-
_ = try astrl.expr(args[0], block, ResultInfo.type_only);
|
|
991
|
-
_ = try astrl.expr(args[1], block, ResultInfo.none);
|
|
992
|
-
return false;
|
|
993
|
-
},
|
|
994
983
|
.reduce => {
|
|
995
984
|
_ = try astrl.expr(args[0], block, ResultInfo.type_only);
|
|
996
985
|
_ = try astrl.expr(args[1], block, ResultInfo.none);
|
package/std/zig/BuiltinFn.zig
CHANGED
|
@@ -20,9 +20,6 @@ pub const Tag = enum {
|
|
|
20
20
|
bit_reverse,
|
|
21
21
|
offset_of,
|
|
22
22
|
call,
|
|
23
|
-
c_define,
|
|
24
|
-
c_import,
|
|
25
|
-
c_include,
|
|
26
23
|
clz,
|
|
27
24
|
cmpxchg_strong,
|
|
28
25
|
cmpxchg_weak,
|
|
@@ -30,7 +27,6 @@ pub const Tag = enum {
|
|
|
30
27
|
compile_log,
|
|
31
28
|
const_cast,
|
|
32
29
|
ctz,
|
|
33
|
-
c_undef,
|
|
34
30
|
c_va_arg,
|
|
35
31
|
c_va_copy,
|
|
36
32
|
c_va_end,
|
|
@@ -306,27 +302,6 @@ pub const list = list: {
|
|
|
306
302
|
.param_count = 3,
|
|
307
303
|
},
|
|
308
304
|
},
|
|
309
|
-
.{
|
|
310
|
-
"@cDefine",
|
|
311
|
-
.{
|
|
312
|
-
.tag = .c_define,
|
|
313
|
-
.param_count = 2,
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
.{
|
|
317
|
-
"@cImport",
|
|
318
|
-
.{
|
|
319
|
-
.tag = .c_import,
|
|
320
|
-
.param_count = 1,
|
|
321
|
-
},
|
|
322
|
-
},
|
|
323
|
-
.{
|
|
324
|
-
"@cInclude",
|
|
325
|
-
.{
|
|
326
|
-
.tag = .c_include,
|
|
327
|
-
.param_count = 1,
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
305
|
.{
|
|
331
306
|
"@clz",
|
|
332
307
|
.{
|
|
@@ -376,13 +351,6 @@ pub const list = list: {
|
|
|
376
351
|
.param_count = 1,
|
|
377
352
|
},
|
|
378
353
|
},
|
|
379
|
-
.{
|
|
380
|
-
"@cUndef",
|
|
381
|
-
.{
|
|
382
|
-
.tag = .c_undef,
|
|
383
|
-
.param_count = 1,
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
354
|
.{
|
|
387
355
|
"@cVaArg",
|
|
388
356
|
.{
|
package/std/zig/Zir.zig
CHANGED
|
@@ -1016,9 +1016,6 @@ pub const Inst = struct {
|
|
|
1016
1016
|
/// Implements the `@max` builtin for 2 args.
|
|
1017
1017
|
/// Uses the `pl_node` union field with payload `Bin`
|
|
1018
1018
|
max,
|
|
1019
|
-
/// Implements the `@cImport` builtin.
|
|
1020
|
-
/// Uses the `pl_node` union field with payload `Block`.
|
|
1021
|
-
c_import,
|
|
1022
1019
|
|
|
1023
1020
|
/// Allocates stack local memory.
|
|
1024
1021
|
/// Uses the `un_node` union field. The operand is the type of the allocated object.
|
|
@@ -1297,7 +1294,6 @@ pub const Inst = struct {
|
|
|
1297
1294
|
.memset,
|
|
1298
1295
|
.memmove,
|
|
1299
1296
|
.min,
|
|
1300
|
-
.c_import,
|
|
1301
1297
|
.@"resume",
|
|
1302
1298
|
.ret_err_value_code,
|
|
1303
1299
|
.extended,
|
|
@@ -1577,7 +1573,6 @@ pub const Inst = struct {
|
|
|
1577
1573
|
.builtin_call,
|
|
1578
1574
|
.max,
|
|
1579
1575
|
.min,
|
|
1580
|
-
.c_import,
|
|
1581
1576
|
.@"resume",
|
|
1582
1577
|
.ret_err_value_code,
|
|
1583
1578
|
.@"break",
|
|
@@ -1857,7 +1852,6 @@ pub const Inst = struct {
|
|
|
1857
1852
|
.memset = .pl_node,
|
|
1858
1853
|
.memmove = .pl_node,
|
|
1859
1854
|
.min = .pl_node,
|
|
1860
|
-
.c_import = .pl_node,
|
|
1861
1855
|
|
|
1862
1856
|
.alloc = .un_node,
|
|
1863
1857
|
.alloc_mut = .un_node,
|
|
@@ -2018,12 +2012,6 @@ pub const Inst = struct {
|
|
|
2018
2012
|
/// `small` is unused.
|
|
2019
2013
|
round_op_ty,
|
|
2020
2014
|
/// `operand` is payload index to `UnNode`.
|
|
2021
|
-
c_undef,
|
|
2022
|
-
/// `operand` is payload index to `UnNode`.
|
|
2023
|
-
c_include,
|
|
2024
|
-
/// `operand` is payload index to `BinNode`.
|
|
2025
|
-
c_define,
|
|
2026
|
-
/// `operand` is payload index to `UnNode`.
|
|
2027
2015
|
wasm_memory_size,
|
|
2028
2016
|
/// `operand` is payload index to `BinNode`.
|
|
2029
2017
|
wasm_memory_grow,
|
|
@@ -4033,30 +4021,30 @@ pub const DeclContents = struct {
|
|
|
4033
4021
|
/// This is a simple optional because ZIR guarantees that a `func`/`func_inferred`/`func_fancy` instruction
|
|
4034
4022
|
/// can only occur once per `declaration`.
|
|
4035
4023
|
func_decl: ?Inst.Index,
|
|
4036
|
-
|
|
4024
|
+
type_decls: std.ArrayList(Inst.Index),
|
|
4037
4025
|
other: std.ArrayList(Inst.Index),
|
|
4038
4026
|
|
|
4039
4027
|
pub const init: DeclContents = .{
|
|
4040
4028
|
.func_decl = null,
|
|
4041
|
-
.
|
|
4029
|
+
.type_decls = .empty,
|
|
4042
4030
|
.other = .empty,
|
|
4043
4031
|
};
|
|
4044
4032
|
|
|
4045
4033
|
pub fn clear(contents: *DeclContents) void {
|
|
4046
4034
|
contents.func_decl = null;
|
|
4047
|
-
contents.
|
|
4035
|
+
contents.type_decls.clearRetainingCapacity();
|
|
4048
4036
|
contents.other.clearRetainingCapacity();
|
|
4049
4037
|
}
|
|
4050
4038
|
|
|
4051
4039
|
pub fn deinit(contents: *DeclContents, gpa: Allocator) void {
|
|
4052
|
-
contents.
|
|
4040
|
+
contents.type_decls.deinit(gpa);
|
|
4053
4041
|
contents.other.deinit(gpa);
|
|
4054
4042
|
}
|
|
4055
4043
|
};
|
|
4056
4044
|
|
|
4057
4045
|
/// Find all tracked ZIR instructions, recursively, within a `declaration` instruction. Does not recurse through
|
|
4058
4046
|
/// nested declarations; to find all declarations, call this function recursively on the type declarations discovered
|
|
4059
|
-
/// in `contents.
|
|
4047
|
+
/// in `contents.type_decls`.
|
|
4060
4048
|
///
|
|
4061
4049
|
/// This populates an `ArrayList` because an iterator would need to allocate memory anyway.
|
|
4062
4050
|
pub fn findTrackable(zir: Zir, gpa: Allocator, contents: *DeclContents, decl_inst: Zir.Inst.Index) !void {
|
|
@@ -4076,15 +4064,49 @@ pub fn findTrackable(zir: Zir, gpa: Allocator, contents: *DeclContents, decl_ins
|
|
|
4076
4064
|
if (decl.value_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
|
|
4077
4065
|
}
|
|
4078
4066
|
|
|
4079
|
-
///
|
|
4080
|
-
///
|
|
4081
|
-
pub fn
|
|
4067
|
+
/// `findTrackable` does not recurse into field expressions in a type. Instead, this function will
|
|
4068
|
+
/// scan specifically field expressions in a given type declaration for trackable ZIR instructions.
|
|
4069
|
+
pub fn findTrackableFields(
|
|
4070
|
+
zir: *const Zir,
|
|
4071
|
+
gpa: Allocator,
|
|
4072
|
+
contents: *DeclContents,
|
|
4073
|
+
type_decl_inst: Zir.Inst.Index,
|
|
4074
|
+
) Allocator.Error!void {
|
|
4082
4075
|
contents.clear();
|
|
4083
4076
|
|
|
4084
4077
|
var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty;
|
|
4085
4078
|
defer found_defers.deinit(gpa);
|
|
4086
4079
|
|
|
4087
|
-
|
|
4080
|
+
assert(zir.instructions.items(.tag)[@intFromEnum(type_decl_inst)] == .extended);
|
|
4081
|
+
switch (zir.instructions.items(.data)[@intFromEnum(type_decl_inst)].extended.opcode) {
|
|
4082
|
+
.struct_decl => {
|
|
4083
|
+
const struct_decl = zir.getStructDecl(type_decl_inst);
|
|
4084
|
+
var it = struct_decl.iterateFields();
|
|
4085
|
+
while (it.next()) |field| {
|
|
4086
|
+
try zir.findTrackableBody(gpa, contents, &found_defers, field.type_body);
|
|
4087
|
+
if (field.align_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
|
|
4088
|
+
if (field.default_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
|
|
4089
|
+
}
|
|
4090
|
+
},
|
|
4091
|
+
.union_decl => {
|
|
4092
|
+
const union_decl = zir.getUnionDecl(type_decl_inst);
|
|
4093
|
+
var it = union_decl.iterateFields();
|
|
4094
|
+
while (it.next()) |field| {
|
|
4095
|
+
if (field.type_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
|
|
4096
|
+
if (field.align_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
|
|
4097
|
+
if (field.value_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
|
|
4098
|
+
}
|
|
4099
|
+
},
|
|
4100
|
+
.enum_decl => {
|
|
4101
|
+
const enum_decl = zir.getEnumDecl(type_decl_inst);
|
|
4102
|
+
var it = enum_decl.iterateFields();
|
|
4103
|
+
while (it.next()) |field| {
|
|
4104
|
+
if (field.value_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
|
|
4105
|
+
}
|
|
4106
|
+
},
|
|
4107
|
+
.opaque_decl => {},
|
|
4108
|
+
else => unreachable,
|
|
4109
|
+
}
|
|
4088
4110
|
}
|
|
4089
4111
|
|
|
4090
4112
|
fn findTrackableInner(
|
|
@@ -4360,9 +4382,6 @@ fn findTrackableInner(
|
|
|
4360
4382
|
.mul_with_overflow,
|
|
4361
4383
|
.shl_with_overflow,
|
|
4362
4384
|
.round_op,
|
|
4363
|
-
.c_undef,
|
|
4364
|
-
.c_include,
|
|
4365
|
-
.c_define,
|
|
4366
4385
|
.wasm_memory_size,
|
|
4367
4386
|
.wasm_memory_grow,
|
|
4368
4387
|
.prefetch,
|
|
@@ -4411,49 +4430,18 @@ fn findTrackableInner(
|
|
|
4411
4430
|
try zir.findTrackableBody(gpa, contents, defers, body);
|
|
4412
4431
|
},
|
|
4413
4432
|
|
|
4414
|
-
// Reifications
|
|
4433
|
+
// Reifications need tracking.
|
|
4415
4434
|
.reify_enum,
|
|
4416
4435
|
.reify_struct,
|
|
4417
4436
|
.reify_union,
|
|
4418
|
-
.opaque_decl,
|
|
4419
4437
|
=> return contents.other.append(gpa, inst),
|
|
4420
4438
|
|
|
4421
|
-
//
|
|
4422
|
-
.struct_decl
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
while (it.next()) |field| {
|
|
4428
|
-
try zir.findTrackableBody(gpa, contents, defers, field.type_body);
|
|
4429
|
-
if (field.align_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
|
|
4430
|
-
if (field.default_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
|
|
4431
|
-
}
|
|
4432
|
-
},
|
|
4433
|
-
|
|
4434
|
-
// Union declarations need tracking and have bodies.
|
|
4435
|
-
.union_decl => {
|
|
4436
|
-
try contents.explicit_types.append(gpa, inst);
|
|
4437
|
-
|
|
4438
|
-
const union_decl = zir.getUnionDecl(inst);
|
|
4439
|
-
var it = union_decl.iterateFields();
|
|
4440
|
-
while (it.next()) |field| {
|
|
4441
|
-
if (field.type_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
|
|
4442
|
-
if (field.align_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
|
|
4443
|
-
if (field.value_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
|
|
4444
|
-
}
|
|
4445
|
-
},
|
|
4446
|
-
|
|
4447
|
-
// Enum declarations need tracking and have bodies.
|
|
4448
|
-
.enum_decl => {
|
|
4449
|
-
try contents.explicit_types.append(gpa, inst);
|
|
4450
|
-
|
|
4451
|
-
const enum_decl = zir.getEnumDecl(inst);
|
|
4452
|
-
var it = enum_decl.iterateFields();
|
|
4453
|
-
while (it.next()) |field| {
|
|
4454
|
-
if (field.value_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
|
|
4455
|
-
}
|
|
4456
|
-
},
|
|
4439
|
+
// Type declarations need tracking.
|
|
4440
|
+
.struct_decl,
|
|
4441
|
+
.union_decl,
|
|
4442
|
+
.enum_decl,
|
|
4443
|
+
.opaque_decl,
|
|
4444
|
+
=> return contents.type_decls.append(gpa, inst),
|
|
4457
4445
|
}
|
|
4458
4446
|
},
|
|
4459
4447
|
|
|
@@ -4532,7 +4520,6 @@ fn findTrackableInner(
|
|
|
4532
4520
|
|
|
4533
4521
|
.block,
|
|
4534
4522
|
.block_inline,
|
|
4535
|
-
.c_import,
|
|
4536
4523
|
.typeof_builtin,
|
|
4537
4524
|
.loop,
|
|
4538
4525
|
=> {
|
package/std/zig.zig
CHANGED
|
@@ -796,11 +796,6 @@ pub const SimpleComptimeReason = enum(u32) {
|
|
|
796
796
|
operand_branchHint,
|
|
797
797
|
operand_setRuntimeSafety,
|
|
798
798
|
operand_embedFile,
|
|
799
|
-
operand_cImport,
|
|
800
|
-
operand_cDefine_macro_name,
|
|
801
|
-
operand_cDefine_macro_value,
|
|
802
|
-
operand_cInclude_file_name,
|
|
803
|
-
operand_cUndef_macro_name,
|
|
804
799
|
operand_shuffle_mask,
|
|
805
800
|
operand_atomicRmw_operation,
|
|
806
801
|
operand_reduce_operation,
|
|
@@ -891,11 +886,6 @@ pub const SimpleComptimeReason = enum(u32) {
|
|
|
891
886
|
.operand_branchHint => "operand to '@branchHint' must be comptime-known",
|
|
892
887
|
.operand_setRuntimeSafety => "operand to '@setRuntimeSafety' must be comptime-known",
|
|
893
888
|
.operand_embedFile => "operand to '@embedFile' must be comptime-known",
|
|
894
|
-
.operand_cImport => "operand to '@cImport' is evaluated at comptime",
|
|
895
|
-
.operand_cDefine_macro_name => "'@cDefine' macro name must be comptime-known",
|
|
896
|
-
.operand_cDefine_macro_value => "'@cDefine' macro value must be comptime-known",
|
|
897
|
-
.operand_cInclude_file_name => "'@cInclude' file name must be comptime-known",
|
|
898
|
-
.operand_cUndef_macro_name => "'@cUndef' macro name must be comptime-known",
|
|
899
889
|
.operand_shuffle_mask => "'@shuffle' mask must be comptime-known",
|
|
900
890
|
.operand_atomicRmw_operation => "'@atomicRmw' operation must be comptime-known",
|
|
901
891
|
.operand_reduce_operation => "'@reduce' operation must be comptime-known",
|