authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-02-23 07:51:23+01:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-02-23 07:51:38+01:00
log800495afab7260d0a32786dd1f26eb5807b1f007
tree1fcbc2eaf04e3b42a530d3ce0d686a5919195bba
parent6abb432598c2d9b4395cc4d86d7d69663b4a0ad0

Builder: fix minor llvm ir syntax errors


1 files changed, 16 insertions(+), 4 deletions(-)

src/codegen/llvm/Builder.zig+16-4
......@@ -1790,6 +1790,18 @@ pub const Linkage = enum(u4) {
17901790 ) @TypeOf(writer).Error!void {
17911791 if (self != .external) try writer.print(" {s}", .{@tagName(self)});
17921792 }
1793
1794 fn formatOptional(
1795 data: ?Linkage,
1796 comptime _: []const u8,
1797 _: std.fmt.FormatOptions,
1798 writer: anytype,
1799 ) @TypeOf(writer).Error!void {
1800 if (data) |linkage| try writer.print(" {s}", .{@tagName(linkage)});
1801 }
1802 pub fn fmtOptional(self: ?Linkage) std.fmt.Formatter(formatOptional) {
1803 return .{ .data = self };
1804 }
17931805};
17941806
17951807pub const Preemption = enum {
......@@ -8073,10 +8085,9 @@ pub const Metadata = enum(u32) {
80738085 try format(.{
80748086 .formatter = data.formatter,
80758087 .node = @unionInit(FormatData.Node, @tagName(tag)["local_".len..], node),
8076 }, "", fmt_opts, writer);
8088 }, "%", fmt_opts, writer);
80778089 },
8078 .string => |node| try writer.print("{s}{}", .{
8079 if (is_specialized) "" else "!",
8090 .string => |node| try writer.print((if (is_specialized) "" else "!") ++ "{}", .{
80808091 node.fmt(builder),
80818092 }),
80828093 inline .bool, .u32, .u64 => |node| try writer.print("{}", .{node}),
......@@ -9276,7 +9287,8 @@ pub fn printUnbuffered(
92769287 \\
92779288 , .{
92789289 variable.global.fmt(self),
9279 global.linkage,
9290 Linkage.fmtOptional(if (global.linkage == .external and
9291 variable.init != .no_init) null else global.linkage),
92809292 global.preemption,
92819293 global.visibility,
92829294 global.dll_storage_class,