| ... | @@ -117,6 +117,10 @@ pub const Node = extern union { | ... | @@ -117,6 +117,10 @@ pub const Node = extern union { |
| 117 | import_c_builtin, | 117 | import_c_builtin, |
| 118 | /// @intCast(operand) | 118 | /// @intCast(operand) |
| 119 | int_cast, | 119 | int_cast, |
| | 120 | /// @constCast(operand) |
| | 121 | const_cast, |
| | 122 | /// @volatileCast(operand) |
| | 123 | volatile_cast, |
| 120 | /// @import("std").zig.c_translation.promoteIntLiteral(value, type, base) | 124 | /// @import("std").zig.c_translation.promoteIntLiteral(value, type, base) |
| 121 | helpers_promoteIntLiteral, | 125 | helpers_promoteIntLiteral, |
| 122 | /// @import("std").zig.c_translation.signedRemainder(lhs, rhs) | 126 | /// @import("std").zig.c_translation.signedRemainder(lhs, rhs) |
| ... | @@ -278,6 +282,8 @@ pub const Node = extern union { | ... | @@ -278,6 +282,8 @@ pub const Node = extern union { |
| 278 | .ptr_from_int, | 282 | .ptr_from_int, |
| 279 | .ptr_cast, | 283 | .ptr_cast, |
| 280 | .int_cast, | 284 | .int_cast, |
| | 285 | .const_cast, |
| | 286 | .volatile_cast, |
| 281 | => Payload.UnOp, | 287 | => Payload.UnOp, |
| 282 | | 288 | |
| 283 | .add, | 289 | .add, |
| ... | @@ -1315,6 +1321,14 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { | ... | @@ -1315,6 +1321,14 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { |
| 1315 | const payload = node.castTag(.int_cast).?.data; | 1321 | const payload = node.castTag(.int_cast).?.data; |
| 1316 | return renderBuiltinCall(c, "@intCast", &.{payload}); | 1322 | return renderBuiltinCall(c, "@intCast", &.{payload}); |
| 1317 | }, | 1323 | }, |
| | 1324 | .const_cast => { |
| | 1325 | const payload = node.castTag(.const_cast).?.data; |
| | 1326 | return renderBuiltinCall(c, "@constCast", &.{payload}); |
| | 1327 | }, |
| | 1328 | .volatile_cast => { |
| | 1329 | const payload = node.castTag(.volatile_cast).?.data; |
| | 1330 | return renderBuiltinCall(c, "@volatileCast", &.{payload}); |
| | 1331 | }, |
| 1318 | .signed_remainder => { | 1332 | .signed_remainder => { |
| 1319 | const payload = node.castTag(.signed_remainder).?.data; | 1333 | const payload = node.castTag(.signed_remainder).?.data; |
| 1320 | const import_node = try renderStdImport(c, &.{ "zig", "c_translation", "signedRemainder" }); | 1334 | const import_node = try renderStdImport(c, &.{ "zig", "c_translation", "signedRemainder" }); |
| ... | @@ -2291,6 +2305,8 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex { | ... | @@ -2291,6 +2305,8 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex { |
| 2291 | .div_trunc, | 2305 | .div_trunc, |
| 2292 | .signed_remainder, | 2306 | .signed_remainder, |
| 2293 | .int_cast, | 2307 | .int_cast, |
| | 2308 | .const_cast, |
| | 2309 | .volatile_cast, |
| 2294 | .as, | 2310 | .as, |
| 2295 | .truncate, | 2311 | .truncate, |
| 2296 | .bit_cast, | 2312 | .bit_cast, |