| author | |
| committer | |
| log | 562f91e875e870eb9f2948dd4de607441f5a6be9 |
| tree | bb1860a238106bade81cfdde40cea637680caec2 |
| parent | e3ad13e05425b3afc9dbac19438ee8a978dcd1e8 |
5 files changed, 10 insertions(+), 1 deletions(-)
src/codegen.cpp+4| ... | @@ -152,6 +152,10 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out | ... | @@ -152,6 +152,10 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out |
| 152 | return g; | 152 | return g; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | void codegen_destroy(CodeGen *codegen) { | ||
| 156 | LLVMDisposeTargetMachine(codegen->target_machine); | ||
| 157 | } | ||
| 158 | |||
| 155 | void codegen_set_output_h_path(CodeGen *g, Buf *h_path) { | 159 | void codegen_set_output_h_path(CodeGen *g, Buf *h_path) { |
| 156 | g->out_h_path = h_path; | 160 | g->out_h_path = h_path; |
| 157 | } | 161 | } |
src/codegen.hpp+1| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | ||
| 17 | CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out_type, BuildMode build_mode, | 17 | CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out_type, BuildMode build_mode, |
| 18 | Buf *zig_lib_dir); | 18 | Buf *zig_lib_dir); |
| 19 | void codegen_destroy(CodeGen *codegen); | ||
| 19 | 20 | ||
| 20 | void codegen_set_clang_argv(CodeGen *codegen, const char **args, size_t len); | 21 | void codegen_set_clang_argv(CodeGen *codegen, const char **args, size_t len); |
| 21 | void codegen_set_llvm_argv(CodeGen *codegen, const char **args, size_t len); | 22 | void codegen_set_llvm_argv(CodeGen *codegen, const char **args, size_t len); |
src/link.cpp+2| ... | @@ -65,6 +65,8 @@ static Buf *build_o_raw(CodeGen *parent_gen, const char *oname, Buf *full_path) | ... | @@ -65,6 +65,8 @@ static Buf *build_o_raw(CodeGen *parent_gen, const char *oname, Buf *full_path) |
| 65 | os_path_join(parent_gen->cache_dir, o_out_name, output_path); | 65 | os_path_join(parent_gen->cache_dir, o_out_name, output_path); |
| 66 | codegen_link(child_gen, buf_ptr(output_path)); | 66 | codegen_link(child_gen, buf_ptr(output_path)); |
| 67 | 67 | ||
| 68 | codegen_destroy(child_gen); | ||
| 69 | |||
| 68 | return output_path; | 70 | return output_path; |
| 69 | } | 71 | } |
| 70 | 72 |
src/main.cpp+1| ... | @@ -421,6 +421,7 @@ int main(int argc, char **argv) { | ... | @@ -421,6 +421,7 @@ int main(int argc, char **argv) { |
| 421 | g->root_package->package_table.put(buf_create_from_str("@build"), build_pkg); | 421 | g->root_package->package_table.put(buf_create_from_str("@build"), build_pkg); |
| 422 | codegen_build(g); | 422 | codegen_build(g); |
| 423 | codegen_link(g, buf_ptr(path_to_build_exe)); | 423 | codegen_link(g, buf_ptr(path_to_build_exe)); |
| 424 | codegen_destroy(g); | ||
| 424 | 425 | ||
| 425 | Termination term; | 426 | Termination term; |
| 426 | os_spawn_process(buf_ptr(path_to_build_exe), args, &term); | 427 | os_spawn_process(buf_ptr(path_to_build_exe), args, &term); |
src/zig_llvm.cpp+2-1| ... | @@ -165,7 +165,8 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM | ... | @@ -165,7 +165,8 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM |
| 165 | 165 | ||
| 166 | MPM.run(*module); | 166 | MPM.run(*module); |
| 167 | 167 | ||
| 168 | dest.flush(); | 168 | dest.close(); |
| 169 | |||
| 169 | return false; | 170 | return false; |
| 170 | } | 171 | } |
| 171 | 172 |