Skip to content

Commit 268a0d0

Browse files
authored
Merge pull request #6400 from diffblue/goto_instruction_location_API
introduce API for goto_instructiont::source_location
2 parents 293748d + 8e14af7 commit 268a0d0

File tree

115 files changed

+720
-648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+720
-648
lines changed

jbmc/src/java_bytecode/convert_java_nondet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static std::pair<goto_programt::targett, bool> insert_nondet_init_code(
102102
if(!nondet_expr.get_nullable())
103103
object_factory_parameters.min_null_tree_depth = 1;
104104

105-
const source_locationt &source_loc = target->source_location;
105+
const source_locationt &source_loc = target->source_location();
106106

107107
// Currently the code looks like this
108108
// target: instruction containing op

jbmc/src/java_bytecode/remove_exceptions.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ void remove_exceptionst::instrument_exception_handler(
246246
instr_it,
247247
goto_programt::make_assignment(
248248
code_assignt(thrown_global_symbol, null_voidptr),
249-
instr_it->source_location));
249+
instr_it->source_location()));
250250

251251
// add the assignment exc = @inflight_exception (before the null assignment)
252252
goto_program.insert_after(
@@ -255,7 +255,7 @@ void remove_exceptionst::instrument_exception_handler(
255255
code_assignt(
256256
thrown_exception_local,
257257
typecast_exprt(thrown_global_symbol, thrown_exception_local.type())),
258-
instr_it->source_location));
258+
instr_it->source_location()));
259259
}
260260

261261
instr_it->turn_into_skip();
@@ -362,7 +362,7 @@ void remove_exceptionst::add_exception_dispatch_sequence(
362362
goto_programt::targett t_exc = goto_program.insert_after(
363363
instr_it,
364364
goto_programt::make_goto(
365-
new_state_pc, true_exprt(), instr_it->source_location));
365+
new_state_pc, true_exprt(), instr_it->source_location()));
366366

367367
// use instanceof to check that this is the correct handler
368368
struct_tag_typet type(stack_catch[i][j].first);
@@ -385,13 +385,13 @@ void remove_exceptionst::add_exception_dispatch_sequence(
385385
}
386386

387387
*default_dispatch = goto_programt::make_goto(
388-
default_target, true_exprt(), instr_it->source_location);
388+
default_target, true_exprt(), instr_it->source_location());
389389

390390
// add dead instructions
391391
for(const auto &local : locals)
392392
{
393393
goto_program.insert_after(
394-
instr_it, goto_programt::make_dead(local, instr_it->source_location));
394+
instr_it, goto_programt::make_dead(local, instr_it->source_location()));
395395
}
396396
}
397397

@@ -476,7 +476,7 @@ remove_exceptionst::instrument_function_call(
476476
goto_programt::make_goto(
477477
next_it,
478478
no_exception_currently_in_flight,
479-
instr_it->source_location));
479+
instr_it->source_location()));
480480

481481
return instrumentation_resultt::ADDED_CODE_WITH_MAY_THROW;
482482
}

jbmc/src/java_bytecode/replace_java_nondet.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,28 +274,28 @@ static goto_programt::targett check_and_replace_target(
274274
const auto &nondet_var = target_instruction->return_value();
275275

276276
side_effect_expr_nondett inserted_expr(
277-
nondet_var.type(), target_instruction->source_location);
277+
nondet_var.type(), target_instruction->source_location());
278278
inserted_expr.set_nullable(
279279
instr_info.get_nullable_type() ==
280280
nondet_instruction_infot::is_nullablet::TRUE);
281281
target_instruction->code_nonconst() = code_returnt(inserted_expr);
282282
target_instruction->code_nonconst().add_source_location() =
283-
target_instruction->source_location;
283+
target_instruction->source_location();
284284
}
285285
else if(target_instruction->is_assign())
286286
{
287287
// Assume that the LHS of *this* assignment is the actual nondet variable
288288
const auto &nondet_var = target_instruction->assign_lhs();
289289

290290
side_effect_expr_nondett inserted_expr(
291-
nondet_var.type(), target_instruction->source_location);
291+
nondet_var.type(), target_instruction->source_location());
292292
inserted_expr.set_nullable(
293293
instr_info.get_nullable_type() ==
294294
nondet_instruction_infot::is_nullablet::TRUE);
295295
target_instruction->code_nonconst() =
296296
code_assignt(nondet_var, inserted_expr);
297297
target_instruction->code_nonconst().add_source_location() =
298-
target_instruction->source_location;
298+
target_instruction->source_location();
299299
}
300300

301301
goto_program.update();

jbmc/unit/java_bytecode/java_virtual_functions/virtual_functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ SCENARIO(
148148

149149
while(it->type != goto_program_instruction_typet::END_FUNCTION)
150150
{
151-
const source_locationt &loc = it->source_location;
151+
const source_locationt &loc = it->source_location();
152152
REQUIRE(loc != source_locationt::nil());
153153
REQUIRE_FALSE(loc.get_java_bytecode_index().empty());
154154
const auto new_index = loc.get_java_bytecode_index();

src/analyses/ai.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ void ai_baset::output(
4545
{
4646
forall_goto_program_instructions(i_it, goto_program)
4747
{
48-
out << "**** " << i_it->location_number << " "
49-
<< i_it->source_location << "\n";
48+
out << "**** " << i_it->location_number << " " << i_it->source_location()
49+
<< "\n";
5050

5151
abstract_state_before(i_it)->output(out, *this, ns);
5252
out << "\n";
@@ -94,7 +94,7 @@ jsont ai_baset::output_json(
9494

9595
json_objectt location{
9696
{"locationNumber", json_numbert(std::to_string(i_it->location_number))},
97-
{"sourceLocation", json_stringt(i_it->source_location.as_string())},
97+
{"sourceLocation", json_stringt(i_it->source_location().as_string())},
9898
{"abstractState", abstract_state_before(i_it)->output_json(*this, ns)},
9999
{"instruction", json_stringt(out.str())}};
100100

@@ -142,7 +142,7 @@ xmlt ai_baset::output_xml(
142142
xmlt location(
143143
"",
144144
{{"location_number", std::to_string(i_it->location_number)},
145-
{"source_location", i_it->source_location.as_string()}},
145+
{"source_location", i_it->source_location().as_string()}},
146146
{abstract_state_before(i_it)->output_xml(*this, ns)});
147147

148148
// Ideally we need output_instruction_xml

src/analyses/custom_bitvector_analysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ void custom_bitvector_analysist::check(
800800
const namespacet ns(goto_model.symbol_table);
801801
result = simplify_expr(std::move(tmp), ns);
802802

803-
description=i_it->source_location.get_comment();
803+
description = i_it->source_location().get_comment();
804804
}
805805
else
806806
continue;
@@ -815,15 +815,15 @@ void custom_bitvector_analysist::check(
815815
else
816816
out << "UNKNOWN";
817817
out << "\">\n";
818-
out << xml(i_it->source_location);
818+
out << xml(i_it->source_location());
819819
out << "<description>"
820820
<< description
821821
<< "</description>\n";
822822
out << "</result>\n\n";
823823
}
824824
else
825825
{
826-
out << i_it->source_location;
826+
out << i_it->source_location();
827827
if(!description.empty())
828828
out << ", " << description;
829829
out << ": ";

src/analyses/dependence_graph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ jsont dep_graph_domaint::output_json(
311311
{
312312
json_objectt link{
313313
{"locationNumber", json_numbert(std::to_string(cd->location_number))},
314-
{"sourceLocation", json(cd->source_location)},
314+
{"sourceLocation", json(cd->source_location())},
315315
{"type", json_stringt("control")}};
316316
graph.push_back(std::move(link));
317317
}
@@ -320,7 +320,7 @@ jsont dep_graph_domaint::output_json(
320320
{
321321
json_objectt link{
322322
{"locationNumber", json_numbert(std::to_string(dd->location_number))},
323-
{"sourceLocation", json(dd->source_location)},
323+
{"sourceLocation", json(dd->source_location())},
324324
{"type", json_stringt("data")}};
325325
graph.push_back(std::move(link));
326326
}

src/analyses/does_remove_const.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ std::pair<bool, source_locationt> does_remove_constt::operator()() const
4646
// const that the lhs
4747
if(!does_type_preserve_const_correctness(&lhs_type, &rhs_type))
4848
{
49-
return {true, instruction.source_location};
49+
return {true, instruction.source_location()};
5050
}
5151

5252
if(does_expr_lose_const(instruction.assign_rhs()))

src/analyses/escape_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ void escape_analysist::insert_cleanup(
420420
bool is_object,
421421
const namespacet &ns)
422422
{
423-
source_locationt source_location=location->source_location;
423+
source_locationt source_location = location->source_location();
424424

425425
for(const auto &cleanup : cleanup_functions)
426426
{

src/analyses/flow_insensitive_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ bool flow_insensitive_analysis_baset::do_function_call(
203203

204204
goto_programt::targett r =
205205
temp.add(goto_programt::make_return(code_returnt(side_effect_expr_nondett(
206-
l_call->call_lhs().type(), l_call->source_location))));
206+
l_call->call_lhs().type(), l_call->source_location()))));
207207
r->location_number=0;
208208

209209
goto_programt::targett t = temp.add(goto_programt::make_end_function());

0 commit comments

Comments
 (0)