Skip to content

Commit e8a1f85

Browse files
committed
switch-case conversion: ensure case selection has source location
The expression operand may be lacking a source location (as was seen on larger projects). Restore a source location by using the one from the case statement.
1 parent 9cc62b5 commit e8a1f85

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/goto-programs/goto_convert.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ void goto_convertt::convert_switch_case(
380380

381381
exprt::operandst &case_op_dest=cases_entry->second->second;
382382
case_op_dest.push_back(code.case_op());
383+
if(case_op_dest.back().source_location().is_nil())
384+
case_op_dest.back().add_source_location() = code.source_location();
383385
}
384386
}
385387

0 commit comments

Comments
 (0)