@@ -162,6 +162,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
162
162
std::unique_ptr<llvm::IRBuilder<>> builder;
163
163
Platform platform;
164
164
bool emit_debug_info;
165
+ bool emit_debug_line_column;
165
166
Allocator &al;
166
167
167
168
llvm::Value *tmp;
@@ -243,7 +244,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
243
244
diag{diagnostics},
244
245
context (context),
245
246
builder (std::make_unique<llvm::IRBuilder<>>(context)),
246
- platform{platform}, emit_debug_info{emit_debug_info},
247
+ platform{platform},
248
+ emit_debug_info{emit_debug_info},
249
+ emit_debug_line_column{emit_debug_line_column},
247
250
al{al},
248
251
prototype_only (false ),
249
252
llvm_utils (std::make_unique<LLVMUtils>(context, builder.get())),
@@ -372,8 +375,12 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
372
375
template <typename T>
373
376
void debug_emit_loc (const T &x) {
374
377
Location loc = x.base .base .loc ;
375
- uint64_t line = loc.first ;
376
- uint64_t column = 0 ;
378
+ uint32_t line, column;
379
+ if (emit_debug_line_column) {
380
+ } else {
381
+ line = loc.first ;
382
+ column = 0 ;
383
+ }
377
384
builder->SetCurrentDebugLocation (
378
385
llvm::DILocation::get (debug_current_scope->getContext (),
379
386
line, column, debug_current_scope));
@@ -385,8 +392,11 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
385
392
debug_CU->getFilename (),
386
393
debug_CU->getDirectory ());
387
394
llvm::DIScope *FContext = debug_Unit;
388
- uint64_t LineNo, ScopeLine;
389
- LineNo = ScopeLine = 0 ;
395
+ uint32_t line, column;
396
+ if (emit_debug_line_column) {
397
+ } else {
398
+ line = 0 ;
399
+ }
390
400
std::string fn_debug_name = x.m_name ;
391
401
llvm::DIBasicType *return_type_info = nullptr ;
392
402
if constexpr (std::is_same_v<T, ASR::Function_t>){
@@ -405,7 +415,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
405
415
DBuilder->getOrCreateTypeArray (return_type_info));
406
416
SP = DBuilder->createFunction (
407
417
FContext, fn_debug_name, llvm::StringRef (), debug_Unit,
408
- LineNo , return_type, ScopeLine,
418
+ line , return_type, 0 , // TODO: ScopeLine
409
419
llvm::DINode::FlagPrototyped,
410
420
llvm::DISubprogram::SPFlagDefinition);
411
421
debug_current_scope = SP;
@@ -2602,17 +2612,22 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
2602
2612
if (emit_debug_info) {
2603
2613
// Reset the debug location
2604
2614
builder->SetCurrentDebugLocation (nullptr );
2605
- uint64_t LineNo = v->base .base .loc .first ;
2615
+ uint32_t line, column;
2616
+ if (emit_debug_line_column) {
2617
+ } else {
2618
+ line = v->base .base .loc .first ;
2619
+ column = 0 ;
2620
+ }
2606
2621
std::string type_name;
2607
2622
uint32_t type_size, type_encoding;
2608
2623
get_type_debug_info (v->m_type , type_name, type_size,
2609
2624
type_encoding);
2610
2625
llvm::DILocalVariable *debug_var = DBuilder->createParameterVariable (
2611
- debug_current_scope, v->m_name , ++debug_arg_count, debug_Unit, LineNo ,
2626
+ debug_current_scope, v->m_name , ++debug_arg_count, debug_Unit, line ,
2612
2627
DBuilder->createBasicType (type_name, type_size, type_encoding), true );
2613
2628
DBuilder->insertDeclare (ptr, debug_var, DBuilder->createExpression (),
2614
2629
llvm::DILocation::get (debug_current_scope->getContext (),
2615
- LineNo , 0 , debug_current_scope), builder->GetInsertBlock ());
2630
+ line , 0 , debug_current_scope), builder->GetInsertBlock ());
2616
2631
}
2617
2632
2618
2633
if ( ASR::is_a<ASR::Struct_t>(*v->m_type ) ) {
0 commit comments