@@ -375,11 +375,20 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
375
375
}
376
376
}
377
377
378
+ void debug_get_line_column (const uint32_t &loc_first,
379
+ uint32_t &line, uint32_t &column) {
380
+ LocationManager lm;
381
+ lm.in_filename = infile;
382
+ lm.init_simple (LFortran::read_file (infile));
383
+ lm.pos_to_linecol (lm.output_to_input_pos (loc_first, false ), line, column);
384
+ }
385
+
378
386
template <typename T>
379
387
void debug_emit_loc (const T &x) {
380
388
Location loc = x.base .base .loc ;
381
389
uint32_t line, column;
382
390
if (emit_debug_line_column) {
391
+ debug_get_line_column (loc.first , line, column);
383
392
} else {
384
393
line = loc.first ;
385
394
column = 0 ;
@@ -397,6 +406,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
397
406
llvm::DIScope *FContext = debug_Unit;
398
407
uint32_t line, column;
399
408
if (emit_debug_line_column) {
409
+ debug_get_line_column (x.base .base .loc .first , line, column);
400
410
} else {
401
411
line = 0 ;
402
412
}
@@ -2617,6 +2627,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
2617
2627
builder->SetCurrentDebugLocation (nullptr );
2618
2628
uint32_t line, column;
2619
2629
if (emit_debug_line_column) {
2630
+ debug_get_line_column (v->base .base .loc .first , line, column);
2620
2631
} else {
2621
2632
line = v->base .base .loc .first ;
2622
2633
column = 0 ;
0 commit comments