aboutsummaryrefslogtreecommitdiff
path: root/src/AstGen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-02-18 09:33:27 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-02-18 09:33:27 -0700
commitefdc94c10712f610e7de5e49fd9cd6f88b4bbbae (patch)
tree4b66ec30176843b0efd87b73199c75aa2fba675d /src/AstGen.zig
parent06df842e4d313e81444063803deff306602e0a17 (diff)
parentc32171991b25b323cd68ff96c294bf5a6fa753b8 (diff)
downloadzig-efdc94c10712f610e7de5e49fd9cd6f88b4bbbae.tar.gz
zig-efdc94c10712f610e7de5e49fd9cd6f88b4bbbae.zip
Merge remote-tracking branch 'origin/master' into llvm16
Diffstat (limited to 'src/AstGen.zig')
-rw-r--r--src/AstGen.zig21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index 10673a2b37..40eef32d4e 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -1730,7 +1730,8 @@ fn structInitExprRlNone(
.container_type = ty_inst,
.name_start = str_index,
}) } }
- else .{ .rl = .none };
+ else
+ .{ .rl = .none };
setExtra(astgen, extra_index, Zir.Inst.StructInitAnon.Item{
.field_name = str_index,
.init = try expr(gz, scope, sub_ri, field_init),
@@ -2530,7 +2531,6 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As
.bit_size_of,
.typeof_log2_int_type,
.ptr_to_int,
- .qual_cast,
.align_of,
.bool_to_int,
.embed_file,
@@ -8038,7 +8038,6 @@ fn builtinCall(
.float_cast => return typeCast(gz, scope, ri, node, params[0], params[1], .float_cast),
.int_cast => return typeCast(gz, scope, ri, node, params[0], params[1], .int_cast),
.ptr_cast => return typeCast(gz, scope, ri, node, params[0], params[1], .ptr_cast),
- .qual_cast => return typeCast(gz, scope, ri, node, params[0], params[1], .qual_cast),
.truncate => return typeCast(gz, scope, ri, node, params[0], params[1], .truncate),
// zig fmt: on
@@ -8114,6 +8113,22 @@ fn builtinCall(
});
return rvalue(gz, ri, result, node);
},
+ .const_cast => {
+ const operand = try expr(gz, scope, .{ .rl = .none }, params[0]);
+ const result = try gz.addExtendedPayload(.const_cast, Zir.Inst.UnNode{
+ .node = gz.nodeIndexToRelative(node),
+ .operand = operand,
+ });
+ return rvalue(gz, ri, result, node);
+ },
+ .volatile_cast => {
+ const operand = try expr(gz, scope, .{ .rl = .none }, params[0]);
+ const result = try gz.addExtendedPayload(.volatile_cast, Zir.Inst.UnNode{
+ .node = gz.nodeIndexToRelative(node),
+ .operand = operand,
+ });
+ return rvalue(gz, ri, result, node);
+ },
// zig fmt: off
.has_decl => return hasDeclOrField(gz, scope, ri, node, params[0], params[1], .has_decl),