Skip to content

Commit fd240b9

Browse files
committed
Fix incorrect DWARF for function parameters
Remove the redundant dereference DW_OP on formal argument's expression mdnode when the LL_BaseDataType is non-pointer.
1 parent 39bd879 commit fd240b9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tools/flang2/flang2exe/cgmain.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12555,10 +12555,13 @@ INLINE static OPERAND *
1255512555
cons_expression_metadata_operand(LL_Type *llTy)
1255612556
{
1255712557
// FIXME: we don't need to always do this, do we? do a type check here
12558-
LL_DebugInfo *di = cpu_llvm_module->debug_info;
12559-
unsigned v = lldbg_encode_expression_arg(LL_DW_OP_deref, 0);
12560-
LL_MDRef exprMD = lldbg_emit_expression_mdnode(di, 1, v);
12561-
return make_mdref_op(exprMD);
12558+
if (llTy->data_type == LL_PTR) {
12559+
LL_DebugInfo *di = cpu_llvm_module->debug_info;
12560+
unsigned v = lldbg_encode_expression_arg(LL_DW_OP_deref, 0);
12561+
LL_MDRef exprMD = lldbg_emit_expression_mdnode(di, 1, v);
12562+
return make_mdref_op(exprMD);
12563+
}
12564+
return NULL;
1256212565
}
1256312566

1256412567
INLINE static bool

0 commit comments

Comments
 (0)