diff options
| author | gingerBill <bill@gingerbill.org> | 2023-01-23 11:38:18 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-01-23 11:38:18 +0000 |
| commit | 55176e52fcb977268625cfc7f7afaaaa6bf5d06f (patch) | |
| tree | 7727aaff0d9516785709fe86da7bdd6a251847a6 /src/llvm_backend_debug.cpp | |
| parent | 4eb08bb0967b1a184c9e5453d20dc187777317ba (diff) | |
Use `heap_allocator()` with `-debug`; Reinstate the arena guards
Diffstat (limited to 'src/llvm_backend_debug.cpp')
| -rw-r--r-- | src/llvm_backend_debug.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp index fc9e63274..f65656494 100644 --- a/src/llvm_backend_debug.cpp +++ b/src/llvm_backend_debug.cpp @@ -620,6 +620,8 @@ gb_internal void lb_debug_complete_types(lbModule *m) { unsigned const word_bits = cast(unsigned)(8*build_context.word_size); for_array(debug_incomplete_type_index, m->debug_incomplete_types) { + TEMPORARY_ALLOCATOR_GUARD(); + auto const &idt = m->debug_incomplete_types[debug_incomplete_type_index]; GB_ASSERT(idt.type != nullptr); GB_ASSERT(idt.metadata != nullptr); @@ -1125,11 +1127,11 @@ gb_internal void lb_add_debug_context_variable(lbProcedure *p, lbAddr const &ctx } -gb_internal String debug_info_mangle_constant_name(Entity *e, bool *did_allocate_) { +gb_internal String debug_info_mangle_constant_name(Entity *e, gbAllocator const &allocator, bool *did_allocate_) { String name = e->token.string; if (e->pkg && e->pkg->name.len > 0) { // NOTE(bill): C++ NONSENSE FOR DEBUG SHITE! - name = concatenate3_strings(heap_allocator(), e->pkg->name, str_lit("::"), name); + name = concatenate3_strings(allocator, e->pkg->name, str_lit("::"), name); if (did_allocate_) *did_allocate_ = true; } return name; @@ -1154,11 +1156,8 @@ gb_internal void add_debug_info_global_variable_expr(lbModule *m, String const & gb_internal void add_debug_info_for_global_constant_internal_i64(lbModule *m, Entity *e, LLVMMetadataRef dtype, i64 v) { LLVMMetadataRef expr = LLVMDIBuilderCreateConstantValueExpression(m->debug_builder, v); - bool did_allocate = false; - String name = debug_info_mangle_constant_name(e, &did_allocate); - defer (if (did_allocate) { - gb_free(heap_allocator(), name.text); - }); + TEMPORARY_ALLOCATOR_GUARD(); + String name = debug_info_mangle_constant_name(e, temporary_allocator(), nullptr); add_debug_info_global_variable_expr(m, name, dtype, expr); if ((e->pkg && e->pkg->kind == Package_Init) || |