Skip to content

Commit 937b5f9

Browse files
Expose conversion of properties of a goto-program into a JSON array
so that it can be reused to goto-diff
1 parent f4a8b0c commit 937b5f9

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/goto-programs/show_properties.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ void show_properties(
108108
}
109109
}
110110

111-
112-
void show_properties_json(
111+
void convert_properties_json(
113112
json_arrayt &json_properties,
114113
const namespacet &ns,
115114
const irep_idt &identifier,
@@ -155,11 +154,7 @@ void show_properties_json(
155154

156155
for(const auto &fct : goto_functions.function_map)
157156
if(!fct.second.is_inlined())
158-
show_properties_json(
159-
json_properties,
160-
ns,
161-
fct.first,
162-
fct.second.body);
157+
convert_properties_json(json_properties, ns, fct.first, fct.second.body);
163158

164159
json_objectt json_result;
165160
json_result["properties"] = json_properties;

src/goto-programs/show_properties.h

+12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Author: Daniel Kroening, [email protected]
1818
class namespacet;
1919
class goto_modelt;
2020
class symbol_tablet;
21+
class goto_programt;
2122
class goto_functionst;
2223
class message_handlert;
2324

@@ -43,4 +44,15 @@ optionalt<source_locationt> find_property(
4344
const irep_idt &property,
4445
const goto_functionst &goto_functions);
4546

47+
/// \brief Collects the properties in the goto program into a `json_arrayt`
48+
/// \param json_properties: JSON array to hold the properties
49+
/// \param ns: namespace
50+
/// \param identifier: function id of the goto program
51+
/// \param goto_program: the goto program
52+
void convert_properties_json(
53+
json_arrayt &json_properties,
54+
const namespacet &ns,
55+
const irep_idt &identifier,
56+
const goto_programt &goto_program);
57+
4658
#endif // CPROVER_GOTO_PROGRAMS_SHOW_PROPERTIES_H

0 commit comments

Comments
 (0)