fix docgen and fix unnecessarily adding .root suffix to objects

This commit is contained in:
Andrew Kelley 2019-03-09 01:00:45 -05:00
parent 5046aa9403
commit 94e52dba85
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 19 additions and 21 deletions

View File

@ -1011,8 +1011,10 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
zig_exe, zig_exe,
"build-exe", "build-exe",
tmp_source_file_name, tmp_source_file_name,
"--output", "--output-dir",
tmp_bin_file_name, tmp_dir_name,
"--name",
code.name,
}); });
try out.print("<pre><code class=\"shell\">$ zig build-exe {}.zig", code.name); try out.print("<pre><code class=\"shell\">$ zig build-exe {}.zig", code.name);
switch (code.mode) { switch (code.mode) {
@ -1085,8 +1087,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
zig_exe, zig_exe,
"test", "test",
tmp_source_file_name, tmp_source_file_name,
"--output", "--output-dir",
test_out_path, tmp_dir_name,
}); });
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name); try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
switch (code.mode) { switch (code.mode) {
@ -1122,8 +1124,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
"--color", "--color",
"on", "on",
tmp_source_file_name, tmp_source_file_name,
"--output", "--output-dir",
test_out_path, tmp_dir_name,
}); });
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name); try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
switch (code.mode) { switch (code.mode) {
@ -1179,8 +1181,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
zig_exe, zig_exe,
"test", "test",
tmp_source_file_name, tmp_source_file_name,
"--output", "--output-dir",
test_out_path, tmp_dir_name,
}); });
switch (code.mode) { switch (code.mode) {
builtin.Mode.Debug => {}, builtin.Mode.Debug => {},
@ -1239,10 +1241,10 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
tmp_source_file_name, tmp_source_file_name,
"--color", "--color",
"on", "on",
"--output", "--name",
tmp_obj_file_name, code.name,
"--output-h", "--output-dir",
output_h_file_name, tmp_dir_name,
}); });
if (!code.is_inline) { if (!code.is_inline) {

View File

@ -9120,18 +9120,14 @@ static void resolve_out_paths(CodeGen *g) {
buf_init_from_buf(&g->output_file_path, g->link_objects.at(0)); buf_init_from_buf(&g->output_file_path, g->link_objects.at(0));
return; return;
} }
if (!need_llvm_module(g) || (g->enable_cache && g->link_objects.length == 0)) { if (need_llvm_module(g) && g->link_objects.length != 0 && !g->enable_cache &&
// Either we're not creating an object file from our LLVM Module, buf_eql_buf(o_basename, out_basename))
// or we have caching enabled and do not need to link objects together. {
// In both cases, the output file path and object file path basename can match.
buf_append_str(o_basename, target_o_file_ext(g->zig_target));
buf_append_str(out_basename, target_o_file_ext(g->zig_target));
} else {
// make it not collide with main output object // make it not collide with main output object
buf_append_str(o_basename, ".root"); buf_append_str(o_basename, ".root");
buf_append_str(o_basename, target_o_file_ext(g->zig_target));
buf_append_str(out_basename, target_o_file_ext(g->zig_target));
} }
buf_append_str(o_basename, target_o_file_ext(g->zig_target));
buf_append_str(out_basename, target_o_file_ext(g->zig_target));
break; break;
case OutTypeExe: case OutTypeExe:
buf_append_str(o_basename, target_o_file_ext(g->zig_target)); buf_append_str(o_basename, target_o_file_ext(g->zig_target));