From a31bab5aae10757f5029b00e39beb0e3815b92b1 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Fri, 23 Sep 2016 14:59:58 +0100 Subject: Unicode file loading; push_allocator & push_context --- src/codegen/print_llvm.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/codegen/print_llvm.cpp') diff --git a/src/codegen/print_llvm.cpp b/src/codegen/print_llvm.cpp index 313299552..9b90106df 100644 --- a/src/codegen/print_llvm.cpp +++ b/src/codegen/print_llvm.cpp @@ -84,8 +84,11 @@ void ssa_print_escape_string(ssaFileBuffer *f, String name, b32 print_quotes) { char hex_table[] = "0123456789ABCDEF"; isize buf_len = name.len + extra + 2; - u8 *buf = gb_alloc_array(gb_heap_allocator(), u8, buf_len); - defer (gb_free(gb_heap_allocator(), buf)); + + gbTempArenaMemory tmp = gb_temp_arena_memory_begin(&string_buffer_arena); + defer (gb_temp_arena_memory_end(tmp)); + + u8 *buf = gb_alloc_array(string_buffer_allocator, u8, buf_len); isize j = 0; @@ -809,9 +812,11 @@ void ssa_print_proc(ssaFileBuffer *f, ssaModule *m, ssaProcedure *proc) { if (proc->module->generate_debug_info && proc->entity != NULL) { - ssaDebugInfo *di = *map_get(&proc->module->debug_info, hash_pointer(proc->entity)); - GB_ASSERT(di->kind == ssaDebugInfo_Proc); - ssa_fprintf(f, "!dbg !%d ", di->id); + if (proc->body != NULL) { + ssaDebugInfo *di = *map_get(&proc->module->debug_info, hash_pointer(proc->entity)); + GB_ASSERT(di->kind == ssaDebugInfo_Proc); + ssa_fprintf(f, "!dbg !%d ", di->id); + } } -- cgit v1.2.3