mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
clean up some resources
This commit is contained in:
parent
e3ad13e054
commit
562f91e875
5 changed files with 10 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machine_ref, LLVMM
|
|||
|
||||
MPM.run(*module);
|
||||
|
||||
dest.flush();
|
||||
dest.close();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue