diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-21 17:14:33 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-21 17:14:33 +0100 |
| commit | d5b1fc48fbc5f853e8995ca520417a69fbad701a (patch) | |
| tree | 6c83a207cd3e76f8bb49912f6ae838ef4b0afc95 /src/llvm_backend.cpp | |
| parent | 0c9e1f5807f84ef243dcece025757476ec18edc3 (diff) | |
Add `@(raddbg_type_view=<optional-string>)`
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.
Diffstat (limited to 'src/llvm_backend.cpp')
| -rw-r--r-- | src/llvm_backend.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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); |