File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
reachable-functions-basic-json
unreachable-functions-basic-json Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 6
6
"function": "obviously_dead",$
7
7
"function": "not_obviously_dead",$
8
8
--
9
+ "last line":[[:space:]]*$
9
10
^warning: ignoring
Original file line number Diff line number Diff line change 6
6
"function": "not_called",
7
7
"last line": 6
8
8
--
9
+ "last line":[[:space:]]*$
9
10
^warning: ignoring
Original file line number Diff line number Diff line change @@ -325,9 +325,21 @@ static void list_functions(
325
325
326
326
goto_programt::const_targett end_function=
327
327
goto_program.instructions .end ();
328
- --end_function;
329
- assert (end_function->is_end_function ());
330
- last_location=end_function->source_location ;
328
+
329
+ // find the last instruction with a line number
330
+ // TODO(tautschnig): #918 will eventually ensure that every instruction
331
+ // has such
332
+ do
333
+ {
334
+ --end_function;
335
+ last_location = end_function->source_location ;
336
+ }
337
+ while (
338
+ end_function != goto_program.instructions .begin () &&
339
+ last_location.get_line ().empty ());
340
+
341
+ if (last_location.get_line ().empty ())
342
+ last_location = decl.location ;
331
343
}
332
344
else
333
345
// completely ignore functions without a body, both for
You can’t perform that action at this time.
0 commit comments