Skip to content

Commit

Permalink
Merge pull request diffblue#1926 from tautschnig/fix-json
Browse files Browse the repository at this point in the history
goto-analyzer (un)reachable-functions: build valid json output
  • Loading branch information
tautschnig committed Mar 12, 2018
2 parents 08ad919 + 22b1628 commit 802b819
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Expand Up @@ -6,4 +6,5 @@ CORE
"function": "obviously_dead",$
"function": "not_obviously_dead",$
--
"last line":[[:space:]]*$
^warning: ignoring
Expand Up @@ -6,4 +6,5 @@ CORE
"function": "not_called",
"last line": 6
--
"last line":[[:space:]]*$
^warning: ignoring
18 changes: 15 additions & 3 deletions src/goto-analyzer/unreachable_instructions.cpp
Expand Up @@ -325,9 +325,21 @@ static void list_functions(

goto_programt::const_targett end_function=
goto_program.instructions.end();
--end_function;
assert(end_function->is_end_function());
last_location=end_function->source_location;

// find the last instruction with a line number
// TODO(tautschnig): #918 will eventually ensure that every instruction
// has such
do
{
--end_function;
last_location = end_function->source_location;
}
while(
end_function != goto_program.instructions.begin() &&
last_location.get_line().empty());

if(last_location.get_line().empty())
last_location = decl.location;
}
else
// completely ignore functions without a body, both for
Expand Down

0 comments on commit 802b819

Please sign in to comment.