aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-07-18 12:49:29 +0100
committergingerBill <bill@gingerbill.org>2022-07-18 12:49:29 +0100
commit6c7e5748a8ee80b01b99fe41192d4aac32651849 (patch)
tree41f8a0f243010e561e81a2f8f437b5ff0f7f873b /src/llvm_backend_stmt.cpp
parent0b0c6da8b0a5f2d31760d579aceae1eb5e8d6671 (diff)
Integrate numerous debug fixes from #1877
Diffstat (limited to 'src/llvm_backend_stmt.cpp')
-rw-r--r--src/llvm_backend_stmt.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/llvm_backend_stmt.cpp b/src/llvm_backend_stmt.cpp
index 2afb5300b..d007ac747 100644
--- a/src/llvm_backend_stmt.cpp
+++ b/src/llvm_backend_stmt.cpp
@@ -1721,6 +1721,9 @@ void lb_build_for_stmt(lbProcedure *p, Ast *node) {
ast_node(fs, ForStmt, node);
lb_open_scope(p, fs->scope); // Open Scope here
+ if (p->debug_info != nullptr) {
+ LLVMSetCurrentDebugLocation2(p->builder, lb_debug_location_from_ast(p, node));
+ }
if (fs->init != nullptr) {
#if 1
@@ -1971,14 +1974,9 @@ void lb_build_stmt(lbProcedure *p, Ast *node) {
}
}
- LLVMMetadataRef prev_debug_location = nullptr;
if (p->debug_info != nullptr) {
- prev_debug_location = LLVMGetCurrentDebugLocation2(p->builder);
LLVMSetCurrentDebugLocation2(p->builder, lb_debug_location_from_ast(p, node));
}
- defer (if (prev_debug_location != nullptr) {
- LLVMSetCurrentDebugLocation2(p->builder, prev_debug_location);
- });
u16 prev_state_flags = p->state_flags;
defer (p->state_flags = prev_state_flags);