File tree 4 files changed +11
-5
lines changed
4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -192,11 +192,17 @@ class function_indicest
192
192
// / was set when this call-graph was constructed the edge will be annotated
193
193
// / with the call-site set.
194
194
// / \return grapht representation of this call_grapht
195
- call_grapht::directed_grapht call_grapht::get_directed_graph () const
195
+ call_grapht::directed_grapht
196
+ call_grapht::get_directed_graph (const goto_modelt &goto_model) const
196
197
{
197
198
call_grapht::directed_grapht ret;
198
199
function_indicest function_indices (ret);
199
200
201
+ // To make sure we include unreachable functions we first create indices
202
+ // for all functions in the function map
203
+ for (const auto &f : goto_model.goto_functions .function_map )
204
+ function_indices[f.first ];
205
+
200
206
for (const auto &edge : graph)
201
207
{
202
208
auto a_index=function_indices[edge.first ];
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ class call_grapht
135
135
}
136
136
};
137
137
138
- directed_grapht get_directed_graph () const ;
138
+ directed_grapht get_directed_graph (const goto_modelt &goto_model ) const ;
139
139
140
140
protected:
141
141
void add (const irep_idt &function,
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ void slice_global_inits(goto_modelt &goto_model)
39
39
// the entry point:
40
40
call_grapht call_graph =
41
41
call_grapht::create_from_root_function (goto_model, entry_point, false );
42
- const auto directed_graph = call_graph.get_directed_graph ();
42
+ const auto directed_graph = call_graph.get_directed_graph (goto_model );
43
43
INVARIANT (
44
44
!directed_graph.empty (), " At least __CPROVER_start should be reachable" );
45
45
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ SCENARIO("call_graph",
176
176
WHEN (" The call graph is exported as a grapht" )
177
177
{
178
178
call_grapht::directed_grapht exported=
179
- call_graph_from_goto_functions.get_directed_graph ();
179
+ call_graph_from_goto_functions.get_directed_graph (goto_model );
180
180
181
181
typedef call_grapht::directed_grapht::node_indext node_indext;
182
182
std::map<irep_idt, node_indext> nodes_by_name;
@@ -234,7 +234,7 @@ SCENARIO("call_graph",
234
234
{
235
235
call_grapht call_graph_from_goto_functions (goto_model, true );
236
236
call_grapht::directed_grapht exported=
237
- call_graph_from_goto_functions.get_directed_graph ();
237
+ call_graph_from_goto_functions.get_directed_graph (goto_model );
238
238
239
239
typedef call_grapht::directed_grapht::node_indext node_indext;
240
240
std::map<irep_idt, node_indext> nodes_by_name;
You can’t perform that action at this time.
0 commit comments