diff options
| author | gingerBill <bill@gingerbill.org> | 2019-09-25 21:07:56 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-09-25 21:07:56 +0100 |
| commit | f4f6e9ad49d6992712815bc7b2e94c8333f33523 (patch) | |
| tree | 8af04986c327a40bfbf2c52d3f34a9ca54f54df2 /src/ir.cpp | |
| parent | 48ab7f876c51dfb009f8ff53d345bb575ce4fb4c (diff) | |
Fix -debug crash on windows caused by missing debug info for files.
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 1c326359b..758267c24 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -10028,7 +10028,11 @@ void ir_init_module(irModule *m, Checker *c) { { irDebugInfo *di = ir_alloc_debug_info(irDebugInfo_CompileUnit); - di->CompileUnit.file = m->info->files.entries[0].value; // Zeroth is the init file + + GB_ASSERT(m->info->files.entries.count > 0); + AstFile *file = m->info->files.entries[0].value; + + di->CompileUnit.file = file; // Zeroth is the init file di->CompileUnit.producer = str_lit("odin"); map_set(&m->debug_info, hash_pointer(m), di); @@ -10047,6 +10051,13 @@ void ir_init_module(irModule *m, Checker *c) { array_init(&m->debug_location_stack, heap_allocator()); // TODO(lachsinc): ir_allocator() ?? } + + { + for_array(i, m->info->files.entries) { + AstFile *file = m->info->files.entries[i].value; + ir_add_debug_info_file(m, file); + } + } } void ir_destroy_module(irModule *m) { |