From d5b1fc48fbc5f853e8995ca520417a69fbad701a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 21 Aug 2025 17:14:33 +0100 Subject: Add `@(raddbg_type_view=)` If no string parameter is provided, then one will be generated from the struct field tags. The attribute must be applied if the automatic struct field tag approach is to be used. --- src/llvm_backend.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/llvm_backend.cpp') diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index fd3701108..ff17e9c10 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -3416,7 +3416,29 @@ gb_internal bool lb_generate_code(lbGenerator *gen) { TEMPORARY_ALLOCATOR_GUARD(); + for (RaddbgTypeView const &type_view : gen->info->raddbg_type_views) { + if (type_view.type == nullptr) { + continue; + } + + if (type_view.view.len == 0) { + continue; + } + + String t_str = type_to_canonical_string(temporary_allocator(), type_view.type); + gbString s = gb_string_make(temporary_allocator(), ""); + + s = gb_string_appendc(s, "type_view: {type: \""); + s = gb_string_append_length(s, t_str.text, t_str.len); + s = gb_string_appendc(s, "\", expr: \""); + s = gb_string_append_length(s, type_view.view.text, type_view.view.len); + s = gb_string_appendc(s, "\"}"); + + lb_add_raddbg_string(m, s); + } + + TEMPORARY_ALLOCATOR_GUARD(); u32 global_name_index = 0; for (String str = {}; mpsc_dequeue(&gen->raddebug_section_strings, &str); /**/) { LLVMValueRef data = LLVMConstStringInContext(ctx, cast(char const *)str.text, cast(unsigned)str.len, false); -- cgit v1.2.3