aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAlex Cameron <ascottcameron@gmail.com>2020-11-19 19:57:22 +1100
committerAlex Cameron <ascottcameron@gmail.com>2020-12-23 01:14:35 +1100
commitc87da2f45afedb33b5d1531ee0e4f67675aa9f78 (patch)
treecf00a715064bfedbcb302393c8a7d7a776d1bc17 /src/Compilation.zig
parentaba273d7313ece312cbf747ab5808063a6d8a1b4 (diff)
downloadzig-c87da2f45afedb33b5d1531ee0e4f67675aa9f78.tar.gz
zig-c87da2f45afedb33b5d1531ee0e4f67675aa9f78.zip
Remove redundant emit_h member in Compilation struct.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 5b06bd6370..2754141370 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -128,11 +128,11 @@ test_filter: ?[]const u8,
test_name_prefix: ?[]const u8,
test_evented_io: bool,
-emit_h: ?EmitLoc,
emit_asm: ?EmitLoc,
emit_llvm_ir: ?EmitLoc,
emit_analysis: ?EmitLoc,
emit_docs: ?EmitLoc,
+
c_header: ?c_link.Header,
pub const InnerError = Module.InnerError;
@@ -973,8 +973,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
.local_cache_directory = options.local_cache_directory,
.global_cache_directory = options.global_cache_directory,
.bin_file = bin_file,
- .emit_h = options.emit_h,
- .c_header = if (!use_llvm and options.emit_h != null) c_link.Header.init(gpa) else null,
+ .c_header = if (!use_llvm and options.emit_h != null) c_link.Header.init(gpa, options.emit_h) else null,
.emit_asm = options.emit_asm,
.emit_llvm_ir = options.emit_llvm_ir,
.emit_analysis = options.emit_analysis,
@@ -1289,7 +1288,7 @@ pub fn update(self: *Compilation) !void {
// If we've chosen to emit a C header, flush the header to the disk.
if (self.c_header) |header| {
- const header_path = self.emit_h.?;
+ const header_path = header.emit_loc.?;
// If a directory has been provided, write the header there. Otherwise, just write it to the
// cache directory.
const header_dir = if (header_path.directory) |dir|
@@ -2952,7 +2951,7 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node
man.hash.add(comp.bin_file.options.function_sections);
man.hash.add(comp.bin_file.options.is_test);
man.hash.add(comp.bin_file.options.emit != null);
- man.hash.addOptionalEmitLoc(comp.emit_h);
+ man.hash.add(comp.c_header != null);
man.hash.addOptionalEmitLoc(comp.emit_asm);
man.hash.addOptionalEmitLoc(comp.emit_llvm_ir);
man.hash.addOptionalEmitLoc(comp.emit_analysis);
@@ -3051,10 +3050,10 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node
});
break :blk try directory.join(arena, &[_][]const u8{bin_basename});
} else "";
- if (comp.emit_h != null) {
+ if (comp.c_header != null) {
log.warn("-femit-h is not available in the stage1 backend; no .h file will be produced", .{});
}
- const emit_h_path = try stage1LocPath(arena, comp.emit_h, directory);
+ const emit_h_path = try stage1LocPath(arena, if (comp.c_header) |header| header.emit_loc else null, directory);
const emit_asm_path = try stage1LocPath(arena, comp.emit_asm, directory);
const emit_llvm_ir_path = try stage1LocPath(arena, comp.emit_llvm_ir, directory);
const emit_analysis_path = try stage1LocPath(arena, comp.emit_analysis, directory);