aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_debug.cpp
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2025-01-08 21:45:59 +0100
committerLaytan Laats <laytanlaats@hotmail.com>2025-01-08 21:45:59 +0100
commit2620721128b2835826faa5d224bf9373a92b1998 (patch)
tree07938dbf8e6c4cf77d97d1273c21dc6e04e582f8 /src/llvm_backend_debug.cpp
parentb3c359557e7c3a1a298ac5b46af122415e43bf77 (diff)
'#no_nil' I am actually disappointed in myself
Diffstat (limited to 'src/llvm_backend_debug.cpp')
-rw-r--r--src/llvm_backend_debug.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp
index 2252c4a31..fbb25960a 100644
--- a/src/llvm_backend_debug.cpp
+++ b/src/llvm_backend_debug.cpp
@@ -408,8 +408,12 @@ gb_internal LLVMMetadataRef lb_debug_union(lbModule *m, Type *type, String name,
lb_set_llvm_metadata(m, type, temp_forward_decl);
isize index_offset = 1;
+ isize variant_offset = 1;
if (is_type_union_maybe_pointer(bt)) {
index_offset = 0;
+ variant_offset = 0;
+ } else if (bt->Union.kind == UnionType_no_nil) {
+ variant_offset = 0;
}
LLVMMetadataRef member_scope = lb_get_llvm_metadata(m, bt->Union.scope);
@@ -438,13 +442,8 @@ gb_internal LLVMMetadataRef lb_debug_union(lbModule *m, Type *type, String name,
for_array(j, bt->Union.variants) {
Type *variant = bt->Union.variants[j];
- ptrdiff_t variant_index = j;
- if (bt->Union.kind != UnionType_no_nil) {
- variant_index += 1;
- }
-
char name[32] = {};
- gb_snprintf(name, gb_size_of(name), "v%td", variant_index);
+ gb_snprintf(name, gb_size_of(name), "v%td", variant_offset+j);
isize name_len = gb_strlen(name);
elements[index_offset+j] = LLVMDIBuilderCreateMemberType(