@@ -13168,7 +13168,12 @@ fn metadataConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata {
13168
13168
return @enumFromInt(gop.index);
13169
13169
}
13170
13170
13171
- pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]const u32 {
13171
+ pub const Producer = struct {
13172
+ name: []const u8,
13173
+ version: std.SemanticVersion,
13174
+ };
13175
+
13176
+ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitcode_writer.Error![]const u32 {
13172
13177
const BitcodeWriter = bitcode_writer.BitcodeWriter(&.{ Type, FunctionAttributes });
13173
13178
var bitcode = BitcodeWriter.init(allocator, .{
13174
13179
std.math.log2_int_ceil(usize, self.type_items.items.len),
@@ -13187,14 +13192,15 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
13187
13192
const Identification = ir.Identification;
13188
13193
var identification_block = try bitcode.enterTopBlock(Identification);
13189
13194
13190
- const producer = try std.fmt.allocPrint(self.gpa, "zig {d}.{d}.{d}", .{
13191
- build_options.semver.major,
13192
- build_options.semver.minor,
13193
- build_options.semver.patch,
13195
+ const producer_str = try std.fmt.allocPrint(self.gpa, "{s} {d}.{d}.{d}", .{
13196
+ producer.name,
13197
+ producer.version.major,
13198
+ producer.version.minor,
13199
+ producer.version.patch,
13194
13200
});
13195
- defer self.gpa.free(producer );
13201
+ defer self.gpa.free(producer_str );
13196
13202
13197
- try identification_block.writeAbbrev(Identification.Version{ .string = producer });
13203
+ try identification_block.writeAbbrev(Identification.Version{ .string = producer_str });
13198
13204
try identification_block.writeAbbrev(Identification.Epoch{ .epoch = 0 });
13199
13205
13200
13206
try identification_block.end();
@@ -15216,10 +15222,9 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
15216
15222
const Allocator = std.mem.Allocator;
15217
15223
const assert = std.debug.assert;
15218
15224
const bitcode_writer = @import("bitcode_writer.zig");
15219
- const build_options = @import("build_options");
15220
15225
const Builder = @This();
15221
15226
const builtin = @import("builtin");
15222
15227
const DW = std.dwarf;
15223
15228
const ir = @import("ir.zig");
15224
15229
const log = std.log.scoped(.llvm);
15225
- const std = @import("std");
15230
+ const std = @import("../../ std.zig ");
0 commit comments