Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ziglang/zig
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e3ad13e05425
Choose a base ref
...
head repository: ziglang/zig
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2a08116788e8
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on Oct 16, 2017

  1. clean up some resources

    andrewrk committed Oct 16, 2017
    Copy the full SHA
    562f91e View commit details
  2. LLD COFF: close handles to objects used to link

    fixes test failures on windows
    See #302
    
    patch sent upstream:
    http://lists.llvm.org/pipermail/llvm-dev/2017-October/118234.html
    andrewrk committed Oct 16, 2017
    Copy the full SHA
    2a08116 View commit details
Showing with 11 additions and 1 deletion.
  1. +1 −0 deps/lld/COFF/Driver.cpp
  2. +4 −0 src/codegen.cpp
  3. +1 −0 src/codegen.hpp
  4. +2 −0 src/link.cpp
  5. +1 −0 src/main.cpp
  6. +2 −1 src/zig_llvm.cpp
1 change: 1 addition & 0 deletions deps/lld/COFF/Driver.cpp
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ bool link(ArrayRef<const char *> Args, raw_ostream &Diag) {
(ErrorOS == &llvm::errs() && Process::StandardErrHasColors());
Driver = make<LinkerDriver>();
Driver->link(Args);
freeArena();
return !ErrorCount;
}

4 changes: 4 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
@@ -152,6 +152,10 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
return g;
}

void codegen_destroy(CodeGen *codegen) {
LLVMDisposeTargetMachine(codegen->target_machine);
}

void codegen_set_output_h_path(CodeGen *g, Buf *h_path) {
g->out_h_path = h_path;
}
1 change: 1 addition & 0 deletions src/codegen.hpp
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@

CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out_type, BuildMode build_mode,
Buf *zig_lib_dir);
void codegen_destroy(CodeGen *codegen);

void codegen_set_clang_argv(CodeGen *codegen, const char **args, size_t len);
void codegen_set_llvm_argv(CodeGen *codegen, const char **args, size_t len);
2 changes: 2 additions & 0 deletions src/link.cpp
Original file line number Diff line number Diff line change
@@ -65,6 +65,8 @@ static Buf *build_o_raw(CodeGen *parent_gen, const char *oname, Buf *full_path)
os_path_join(parent_gen->cache_dir, o_out_name, output_path);
codegen_link(child_gen, buf_ptr(output_path));

codegen_destroy(child_gen);

return output_path;
}

1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -421,6 +421,7 @@ int main(int argc, char **argv) {
g->root_package->package_table.put(buf_create_from_str("@build"), build_pkg);
codegen_build(g);
codegen_link(g, buf_ptr(path_to_build_exe));
codegen_destroy(g);

Termination term;
os_spawn_process(buf_ptr(path_to_build_exe), args, &term);
3 changes: 2 additions & 1 deletion src/zig_llvm.cpp
Original file line number Diff line number Diff line change
@@ -165,7 +165,8 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM

MPM.run(*module);

dest.flush();
dest.close();

return false;
}