| ... | @@ -1230,8 +1230,7 @@ pub fn genDecl(o: *Object) !void { | ... | @@ -1230,8 +1230,7 @@ pub fn genDecl(o: *Object) !void { |
| 1230 | try fwd_decl_writer.writeAll("zig_threadlocal "); | 1230 | try fwd_decl_writer.writeAll("zig_threadlocal "); |
| 1231 | } | 1231 | } |
| 1232 | | 1232 | |
| 1233 | const decl_c_value: CValue = if (is_global) .{ .bytes = mem.span(o.dg.decl.name) } | 1233 | const decl_c_value: CValue = if (is_global) .{ .bytes = mem.span(o.dg.decl.name) } else .{ .decl = o.dg.decl }; |
| 1234 | else .{ .decl = o.dg.decl }; | | |
| 1235 | | 1234 | |
| 1236 | try o.dg.renderTypeAndName(fwd_decl_writer, o.dg.decl.ty, decl_c_value, .Mut, o.dg.decl.align_val); | 1235 | try o.dg.renderTypeAndName(fwd_decl_writer, o.dg.decl.ty, decl_c_value, .Mut, o.dg.decl.align_val); |
| 1237 | try fwd_decl_writer.writeAll(";\n"); | 1236 | try fwd_decl_writer.writeAll(";\n"); |
| ... | @@ -2770,7 +2769,7 @@ fn structFieldPtr(f: *Function, inst: Air.Inst.Index, struct_ptr_ty: Type, struc | ... | @@ -2770,7 +2769,7 @@ fn structFieldPtr(f: *Function, inst: Air.Inst.Index, struct_ptr_ty: Type, struc |
| 2770 | const writer = f.object.writer(); | 2769 | const writer = f.object.writer(); |
| 2771 | const struct_ty = struct_ptr_ty.elemType(); | 2770 | const struct_ty = struct_ptr_ty.elemType(); |
| 2772 | var field_name: []const u8 = undefined; | 2771 | var field_name: []const u8 = undefined; |
| 2773 | var field_val_ty: Type = undefined; | 2772 | var field_val_ty: Type = undefined; |
| 2774 | | 2773 | |
| 2775 | switch (struct_ty.tag()) { | 2774 | switch (struct_ty.tag()) { |
| 2776 | .@"struct" => { | 2775 | .@"struct" => { |
| ... | @@ -3167,7 +3166,7 @@ fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3167,7 +3166,7 @@ fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3167 | const union_ty = f.air.typeOf(bin_op.lhs).childType(); | 3166 | const union_ty = f.air.typeOf(bin_op.lhs).childType(); |
| 3168 | const target = f.object.dg.module.getTarget(); | 3167 | const target = f.object.dg.module.getTarget(); |
| 3169 | const layout = union_ty.unionGetLayout(target); | 3168 | const layout = union_ty.unionGetLayout(target); |
| 3170 | if (layout.tag_size == 0) return CValue.none; | 3169 | if (layout.tag_size == 0) return CValue.none; |
| 3171 | | 3170 | |
| 3172 | try f.writeCValue(writer, union_ptr); | 3171 | try f.writeCValue(writer, union_ptr); |
| 3173 | try writer.writeAll("->tag = "); | 3172 | try writer.writeAll("->tag = "); |
| ... | @@ -3190,7 +3189,7 @@ fn airGetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3190,7 +3189,7 @@ fn airGetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3190 | | 3189 | |
| 3191 | const target = f.object.dg.module.getTarget(); | 3190 | const target = f.object.dg.module.getTarget(); |
| 3192 | const layout = un_ty.unionGetLayout(target); | 3191 | const layout = un_ty.unionGetLayout(target); |
| 3193 | if (layout.tag_size == 0) return CValue.none; | 3192 | if (layout.tag_size == 0) return CValue.none; |
| 3194 | | 3193 | |
| 3195 | try writer.writeAll(" = "); | 3194 | try writer.writeAll(" = "); |
| 3196 | try f.writeCValue(writer, operand); | 3195 | try f.writeCValue(writer, operand); |