From d1a2e6e5bd7428e304fce8d6523789a19018aadb Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Fri, 6 Dec 2024 02:18:30 +0100 Subject: [PATCH] Update Windows debug output. --- src/compiler/llvm_codegen_debug_info.c | 2 ++ src/compiler/llvm_codegen_internal.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/llvm_codegen_debug_info.c b/src/compiler/llvm_codegen_debug_info.c index 7010b7bd2..15e431a9f 100644 --- a/src/compiler/llvm_codegen_debug_info.c +++ b/src/compiler/llvm_codegen_debug_info.c @@ -24,6 +24,7 @@ static LLVMMetadataRef llvm_debug_enum_type(GenContext *c, Type *type, LLVMMetad INLINE LLVMMetadataRef llvm_create_debug_location_with_inline(GenContext *c, unsigned row, unsigned col, LLVMMetadataRef scope) { + if (!c->debug.emit_expr_loc) col = 0; return LLVMDIBuilderCreateDebugLocation(c->context, row, col, scope, c->debug.block_stack->inline_loc ? c->debug.block_stack->inline_loc : NULL); } @@ -223,6 +224,7 @@ void llvm_emit_debug_location(GenContext *c, SourceSpan location) LLVMMetadataRef oldloc = LLVMGetCurrentDebugLocation2(c->builder); if (oldloc && c->last_emitted_loc.a == location.a) return; LLVMMetadataRef loc = c->last_loc = llvm_create_debug_location(c, location); + if (!c->debug.emit_expr_loc) location.col = 0; c->last_emitted_loc.a = location.a; LLVMSetCurrentDebugLocation2(c->builder, loc); diff --git a/src/compiler/llvm_codegen_internal.h b/src/compiler/llvm_codegen_internal.h index 53bf13297..d63ad8c02 100644 --- a/src/compiler/llvm_codegen_internal.h +++ b/src/compiler/llvm_codegen_internal.h @@ -576,7 +576,7 @@ void llvm_emit_debug_local_var(GenContext *c, Decl *var); #define UWTABLE (compiler.build.arch_os_target == MACOS_AARCH64 ? 1 : 2) #define EMIT_LOC(c, x) do { if (c->debug.builder) llvm_emit_debug_location(c, x->span); } while (0) -#define EMIT_EXPR_LOC(c, x) do { if (c->debug.emit_expr_loc) llvm_emit_debug_location(c, x->span); } while (0) +#define EMIT_EXPR_LOC(c, x) do { if (c->debug.builder) llvm_emit_debug_location(c, x->span); } while (0) #define EMIT_SPAN(c, x) do { if (c->debug.builder) llvm_emit_debug_location(c, x); } while (0) #define PUSH_DEFER_ERROR(val__) LLVMValueRef def_err__ = c->defer_error_var; c->defer_error_var = val__ #define POP_DEFER_ERROR() c->defer_error_var = def_err__