Skip to content

Commit ad48666

Browse files
committed
fix disposing builder when not created
Fixes #5128 p->builder is created in lb_begin_procedure_body, but that isn't called if there is no body, and we were still calling dispose at that point. Moved it into lb_end_procedure_body to match.
1 parent 90a30a1 commit ad48666

File tree

3 files changed

+1
-4
lines changed

3 files changed

+1
-4
lines changed

src/llvm_backend.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,6 @@ gb_internal void lb_generate_procedure(lbModule *m, lbProcedure *p) {
21852185
p->is_done = true;
21862186
m->curr_procedure = nullptr;
21872187
}
2188-
lb_end_procedure(p);
21892188

21902189
// Add Flags
21912190
if (p->entity && p->entity->kind == Entity_Procedure && p->entity->Procedure.is_memcpy_like) {

src/llvm_backend.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ gb_internal LLVMAttributeRef lb_create_enum_attribute_with_type(LLVMContextRef c
409409
gb_internal void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, char const *name, u64 value);
410410
gb_internal void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, char const *name);
411411
gb_internal lbProcedure *lb_create_procedure(lbModule *module, Entity *entity, bool ignore_body=false);
412-
gb_internal void lb_end_procedure(lbProcedure *p);
413412

414413

415414
gb_internal LLVMTypeRef lb_type(lbModule *m, Type *type);

src/llvm_backend_proc.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,7 @@ gb_internal void lb_end_procedure_body(lbProcedure *p) {
783783

784784
p->curr_block = nullptr;
785785
p->state_flags = 0;
786-
}
787-
gb_internal void lb_end_procedure(lbProcedure *p) {
786+
788787
LLVMDisposeBuilder(p->builder);
789788
}
790789

0 commit comments

Comments
 (0)