Update Windows debug output.

This commit is contained in:
Christoffer Lerno
2024-12-06 02:18:30 +01:00
parent c96985f1db
commit d1a2e6e5bd
2 changed files with 3 additions and 1 deletions

View File

@@ -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);

View File

@@ -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__