Skip to content

Commit 26975f3

Browse files
committed
Change 'pc' to 'progam_counter'
This is likely an acronym that is well-known if you're knowledgable of the subject area, but only in a few places is it referred by it's full name, and it confused me until I found that comment.
1 parent 4eb7d04 commit 26975f3

27 files changed

+127
-105
lines changed

src/cbmc/all_properties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ safety_checkert::resultt bmc_all_propertiest::operator()()
8383
if(property_id.empty())
8484
continue;
8585

86-
if(it->source.pc->is_goto())
86+
if(it->source.program_counter->is_goto())
8787
{
8888
// goto may yield an unwinding assertion
8989
goal_map[property_id].description = it->comment;

src/cbmc/bmc_cover.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,11 @@ bool bmc_covert::operator()()
224224
{
225225
if(it->is_assert())
226226
{
227-
PRECONDITION(it->source.pc->is_assert());
227+
PRECONDITION(it->source.program_counter->is_assert());
228228
const and_exprt c(
229229
literal_exprt(it->guard_literal), literal_exprt(!it->cond_literal));
230230
literalt l_c=solver.convert(c);
231-
goal_map[id(it->source.pc)].add_instance(it, l_c);
231+
goal_map[id(it->source.program_counter)].add_instance(it, l_c);
232232
}
233233
}
234234

src/cbmc/fault_localization.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void fault_localizationt::collect_guards(lpointst &lpoints)
5555
{
5656
if(!it->guard_literal.is_constant())
5757
{
58-
lpoints[it->guard_literal].target=it->source.pc;
58+
lpoints[it->guard_literal].target=it->source.program_counter;
5959
lpoints[it->guard_literal].score=0;
6060
}
6161
}
@@ -148,7 +148,7 @@ void fault_localizationt::run(irep_idt goal_id)
148148
PRECONDITION(failed != bmc.equation.SSA_steps.end());
149149

150150
if(goal_id==ID_nil)
151-
goal_id=failed->source.pc->source_location.get_property_id();
151+
goal_id=failed->source.program_counter->source_location.get_property_id();
152152
lpointst &lpoints=lpoints_map[goal_id];
153153

154154
// collect lpoints
@@ -171,7 +171,7 @@ void fault_localizationt::run(irep_idt goal_id)
171171
void fault_localizationt::report(irep_idt goal_id)
172172
{
173173
if(goal_id==ID_nil)
174-
goal_id=failed->source.pc->source_location.get_property_id();
174+
goal_id=failed->source.program_counter->source_location.get_property_id();
175175

176176
lpointst &lpoints=lpoints_map[goal_id];
177177

@@ -203,7 +203,7 @@ xmlt fault_localizationt::report_xml(irep_idt goal_id)
203203
xml_diagnosis.new_element("method").data="linear fault localization";
204204

205205
if(goal_id==ID_nil)
206-
goal_id=failed->source.pc->source_location.get_property_id();
206+
goal_id=failed->source.program_counter->source_location.get_property_id();
207207

208208
xml_diagnosis.set_attribute("property", id2string(goal_id));
209209

src/goto-checker/bmc_util.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ std::vector<irep_idt> update_properties_status_from_symex_target_equation(
245245
const auto status = step.cond_expr.is_true() ? property_statust::PASS
246246
: property_statust::UNKNOWN;
247247
auto emplace_result = properties.emplace(
248-
property_id, property_infot{step.source.pc, step.comment, status});
248+
property_id,
249+
property_infot{step.source.program_counter, step.comment, status});
249250

250251
if(emplace_result.second)
251252
{

src/goto-checker/symex_bmc.cpp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ void symex_bmct::symex_step(
3535
const get_goto_functiont &get_goto_function,
3636
statet &state)
3737
{
38-
const source_locationt &source_location = state.source.pc->source_location;
38+
const source_locationt &source_location =
39+
state.source.program_counter->source_location;
3940

4041
if(!source_location.is_nil() && last_source_location != source_location)
4142
{
@@ -45,18 +46,19 @@ void symex_bmct::symex_step(
4546
last_source_location = source_location;
4647
}
4748

48-
const goto_programt::const_targett cur_pc = state.source.pc;
49+
const goto_programt::const_targett cur_pc = state.source.program_counter;
4950
const guardt cur_guard = state.guard;
5051

5152
if(
52-
!state.guard.is_false() && state.source.pc->is_assume() &&
53-
simplify_expr(state.source.pc->guard, ns).is_false())
53+
!state.guard.is_false() && state.source.program_counter->is_assume() &&
54+
simplify_expr(state.source.program_counter->guard, ns).is_false())
5455
{
5556
log.statistics() << "aborting path on assume(false) at "
56-
<< state.source.pc->source_location << " thread "
57-
<< state.source.thread_nr;
57+
<< state.source.program_counter->source_location
58+
<< " thread " << state.source.thread_nr;
5859

59-
const irep_idt &c = state.source.pc->source_location.get_comment();
60+
const irep_idt &c =
61+
state.source.program_counter->source_location.get_comment();
6062
if(!c.empty())
6163
log.statistics() << ": " << c;
6264

@@ -67,7 +69,7 @@ void symex_bmct::symex_step(
6769

6870
if(
6971
record_coverage &&
70-
// avoid an invalid iterator in state.source.pc
72+
// avoid an invalid iterator in state.source.program_counter
7173
(!cur_pc->is_end_function() ||
7274
state.source.function_id != goto_functionst::entry_point()))
7375
{
@@ -78,19 +80,21 @@ void symex_bmct::symex_step(
7880
// transition from the goto instruction to its target to make
7981
// sure the goto is considered covered
8082
if(
81-
cur_pc->is_goto() && cur_pc->get_target() != state.source.pc &&
83+
cur_pc->is_goto() &&
84+
cur_pc->get_target() != state.source.program_counter &&
8285
cur_pc->guard.is_true())
8386
symex_coverage.covered(cur_pc, cur_pc->get_target());
8487
else if(!state.guard.is_false())
85-
symex_coverage.covered(cur_pc, state.source.pc);
88+
symex_coverage.covered(cur_pc, state.source.program_counter);
8689
}
8790
}
8891

8992
void symex_bmct::merge_goto(
9093
const statet::goto_statet &goto_state,
9194
statet &state)
9295
{
93-
const goto_programt::const_targett prev_pc = goto_state.source.pc;
96+
const goto_programt::const_targett prev_pc =
97+
goto_state.source.program_counter;
9498
const guardt prev_guard = goto_state.guard;
9599

96100
goto_symext::merge_goto(goto_state, state);
@@ -102,23 +106,24 @@ void symex_bmct::merge_goto(
102106
!prev_guard.is_false() && !state.guard.is_false() &&
103107
// branches only, no single-successor goto
104108
!prev_pc->guard.is_true())
105-
symex_coverage.covered(prev_pc, state.source.pc);
109+
symex_coverage.covered(prev_pc, state.source.program_counter);
106110
}
107111

108112
bool symex_bmct::should_stop_unwind(
109113
const symex_targett::sourcet &source,
110114
const goto_symex_statet::call_stackt &context,
111115
unsigned unwind)
112116
{
113-
const irep_idt id = goto_programt::loop_id(source.function_id, *source.pc);
117+
const irep_idt id =
118+
goto_programt::loop_id(source.function_id, *source.program_counter);
114119

115120
tvt abort_unwind_decision;
116121
unsigned this_loop_limit = std::numeric_limits<unsigned>::max();
117122

118123
for(auto handler : loop_unwind_handlers)
119124
{
120-
abort_unwind_decision =
121-
handler(context, source.pc->loop_number, unwind, this_loop_limit);
125+
abort_unwind_decision = handler(
126+
context, source.program_counter->loop_number, unwind, this_loop_limit);
122127
if(abort_unwind_decision.is_known())
123128
break;
124129
}
@@ -145,8 +150,8 @@ bool symex_bmct::should_stop_unwind(
145150
if(this_loop_limit != std::numeric_limits<unsigned>::max())
146151
log.statistics() << " (" << this_loop_limit << " max)";
147152

148-
log.statistics() << " " << source.pc->source_location << " thread "
149-
<< source.thread_nr << log.eom;
153+
log.statistics() << " " << source.program_counter->source_location
154+
<< " thread " << source.thread_nr << log.eom;
150155

151156
return abort;
152157
}

src/goto-programs/graphml_witness.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,12 @@ void graphml_witnesst::operator()(const symex_target_equationt &equation)
374374
it!=equation.SSA_steps.end();
375375
it++, step_nr++) // we cannot replace this by a ranged for
376376
{
377-
const source_locationt &source_location=it->source.pc->source_location;
377+
const source_locationt &source_location =
378+
it->source.program_counter->source_location;
378379

379380
if(it->hidden ||
380381
(!it->is_assignment() && !it->is_goto() && !it->is_assert()) ||
381-
(it->is_goto() && it->source.pc->guard.is_true()) ||
382+
(it->is_goto() && it->source.program_counter->guard.is_true()) ||
382383
source_location.is_nil() ||
383384
source_location.is_built_in() ||
384385
source_location.get_line().empty())
@@ -391,10 +392,11 @@ void graphml_witnesst::operator()(const symex_target_equationt &equation)
391392
// skip declarations followed by an immediate assignment
392393
symex_target_equationt::SSA_stepst::const_iterator next=it;
393394
++next;
394-
if(next!=equation.SSA_steps.end() &&
395-
next->is_assignment() &&
396-
it->ssa_full_lhs==next->ssa_full_lhs &&
397-
it->source.pc->source_location==next->source.pc->source_location)
395+
if(
396+
next != equation.SSA_steps.end() && next->is_assignment() &&
397+
it->ssa_full_lhs == next->ssa_full_lhs &&
398+
it->source.program_counter->source_location ==
399+
next->source.program_counter->source_location)
398400
{
399401
step_to_node[step_nr]=sink;
400402

@@ -403,7 +405,7 @@ void graphml_witnesst::operator()(const symex_target_equationt &equation)
403405

404406
const graphmlt::node_indext node=graphml.add_node();
405407
graphml[node].node_name=
406-
std::to_string(it->source.pc->location_number)+"."+
408+
std::to_string(it->source.program_counter->location_number)+"."+
407409
std::to_string(step_nr);
408410
graphml[node].file=source_location.get_file();
409411
graphml[node].line=source_location.get_line();
@@ -433,8 +435,9 @@ void graphml_witnesst::operator()(const symex_target_equationt &equation)
433435
symex_target_equationt::SSA_stepst::const_iterator next=it;
434436
std::size_t next_step_nr=step_nr;
435437
for(++next, ++next_step_nr;
436-
next!=equation.SSA_steps.end() &&
437-
(step_to_node[next_step_nr]==sink || it->source.pc==next->source.pc);
438+
next != equation.SSA_steps.end() &&
439+
(step_to_node[next_step_nr] == sink ||
440+
it->source.program_counter == next->source.program_counter);
438441
++next, ++next_step_nr)
439442
{
440443
// advance
@@ -475,11 +478,11 @@ void graphml_witnesst::operator()(const symex_target_equationt &equation)
475478
graphml[to].has_invariant=true;
476479
code_assignt assign(it->ssa_full_lhs, it->ssa_rhs);
477480
graphml[to].invariant=convert_assign_rec(identifier, assign);
478-
graphml[to].invariant_scope=
479-
id2string(it->source.pc->source_location.get_function());
481+
graphml[to].invariant_scope = id2string(
482+
it->source.program_counter->source_location.get_function());
480483
}
481484
else if(it->is_goto() &&
482-
it->source.pc->is_goto())
485+
it->source.program_counter->is_goto())
483486
{
484487
xmlt &val=edge.new_element("data");
485488
val.set_attribute("key", "sourcecode");

src/goto-symex/build_goto_trace.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void update_internal_field(
144144
// set internal field to CPROVER functions (e.g., __CPROVER_initialize)
145145
if(SSA_step.is_function_call())
146146
{
147-
if(SSA_step.source.pc->source_location.as_string().empty())
147+
if(SSA_step.source.program_counter->source_location.as_string().empty())
148148
goto_trace_step.internal=true;
149149
}
150150

@@ -161,7 +161,7 @@ void update_internal_field(
161161
// "__CPROVER_*" function calls in __CPROVER_start are already marked as
162162
// internal. Don't mark any other function calls (i.e. "main"), function
163163
// arguments or any other parts of a code_function_callt as internal.
164-
if(SSA_step.source.pc->code.get_statement()!=ID_function_call)
164+
if(SSA_step.source.program_counter->code.get_statement()!=ID_function_call)
165165
goto_trace_step.internal=true;
166166
}
167167
}
@@ -303,7 +303,7 @@ void build_goto_trace(
303303
goto_trace_step.step_nr = ++step_nr;
304304

305305
goto_trace_step.thread_nr = SSA_step.source.thread_nr;
306-
goto_trace_step.pc = SSA_step.source.pc;
306+
goto_trace_step.pc = SSA_step.source.program_counter;
307307
goto_trace_step.function_id = SSA_step.source.function_id;
308308
if(SSA_step.is_assert())
309309
{

src/goto-symex/equation_conversion_exceptions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class equation_conversion_exceptiont : public std::runtime_error
2828
{
2929
std::ostringstream error_msg;
3030
error_msg << runtime_error::what();
31-
error_msg << "\nSource GOTO statement: " << format(step.source.pc->code);
31+
error_msg << "\nSource GOTO statement: "
32+
<< format(step.source.program_counter->code);
3233
error_msg << "\nStep:\n";
3334
step.output(error_msg);
3435
error_message = error_msg.str();

src/goto-symex/goto_symex_state.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,8 @@ void goto_symex_statet::print_backtrace(std::ostream &out) const
817817
return;
818818
}
819819

820-
out << source.function_id << " " << source.pc->location_number << "\n";
820+
out << source.function_id << " " << source.program_counter->location_number
821+
<< "\n";
821822

822823
for(auto stackit = threads[source.thread_nr].call_stack.rbegin(),
823824
stackend = threads[source.thread_nr].call_stack.rend();
@@ -828,7 +829,7 @@ void goto_symex_statet::print_backtrace(std::ostream &out) const
828829
if(frame.calling_location.is_set)
829830
{
830831
out << frame.calling_location.function_id << " "
831-
<< frame.calling_location.pc->location_number << "\n";
832+
<< frame.calling_location.program_counter->location_number << "\n";
832833
}
833834
}
834835
}

src/goto-symex/memory_model_tso.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void memory_model_tsot::program_order(
106106

107107
if((*e_it2)->is_memory_barrier())
108108
{
109-
const codet &code = (*e_it2)->source.pc->code;
109+
const codet &code = (*e_it2)->source.program_counter->code;
110110

111111
if((*e_it)->is_shared_read() &&
112112
!code.get_bool(ID_RRfence) &&

src/goto-symex/show_program.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ void show_program(const namespacet &ns, const symex_target_equationt &equation)
5858

5959
for(const auto &step : equation.SSA_steps)
6060
{
61-
std::cout << "// " << step.source.pc->location_number << " ";
62-
std::cout << step.source.pc->source_location.as_string() << "\n";
61+
std::cout << "// " << step.source.program_counter->location_number << " ";
62+
std::cout << step.source.program_counter->source_location.as_string()
63+
<< "\n";
6364

6465
if(step.is_assignment())
6566
show_step(ns, step, "", count);

src/goto-symex/show_vcc.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ void show_vcc_plain(
4343
else
4444
out << '\n';
4545

46-
if(s_it->source.pc->source_location.is_not_nil())
47-
out << s_it->source.pc->source_location << '\n';
46+
if(s_it->source.program_counter->source_location.is_not_nil())
47+
out << s_it->source.program_counter->source_location << '\n';
4848

4949
if(s_it->comment != "")
5050
out << s_it->comment << '\n';
@@ -120,7 +120,8 @@ void show_vcc_json(
120120
// vcc object
121121
json_objectt &object = json_vccs.push_back(jsont()).make_object();
122122

123-
const source_locationt &source_location = s_it->source.pc->source_location;
123+
const source_locationt &source_location =
124+
s_it->source.program_counter->source_location;
124125
if(source_location.is_not_nil())
125126
object["sourceLocation"] = json(source_location);
126127

src/goto-symex/symex_assign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void goto_symext::symex_assign(
7171
assignment_type=symex_targett::assignment_typet::HIDDEN;
7272

7373
// We hide if we are executing a hidden instruction.
74-
if(state.source.pc->source_location.get_hide())
74+
if(state.source.program_counter->source_location.get_hide())
7575
assignment_type=symex_targett::assignment_typet::HIDDEN;
7676

7777
guardt guard{true_exprt{}}; // NOT the state guard!

src/goto-symex/symex_atomic_section.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void goto_symext::symex_atomic_begin(statet &state)
2121
if(state.atomic_section_id != 0)
2222
throw incorrect_goto_program_exceptiont(
2323
"we don't support nesting of atomic sections",
24-
state.source.pc->source_location);
24+
state.source.program_counter->source_location);
2525

2626
state.atomic_section_id=++atomic_section_counter;
2727
state.read_in_atomic_section.clear();
@@ -40,7 +40,7 @@ void goto_symext::symex_atomic_end(statet &state)
4040

4141
if(state.atomic_section_id == 0)
4242
throw incorrect_goto_program_exceptiont(
43-
"ATOMIC_END unmatched", state.source.pc->source_location);
43+
"ATOMIC_END unmatched", state.source.program_counter->source_location);
4444

4545
const unsigned atomic_section_id=state.atomic_section_id;
4646
state.atomic_section_id=0;

src/goto-symex/symex_catch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void goto_symext::symex_catch(statet &)
1818
// there are two variants: 'push' and 'pop'
1919

2020
#if 0
21-
const goto_programt::instructiont &instruction=*state.source.pc;
21+
const goto_programt::instructiont &instruction=*state.source.program_counter;
2222

2323
if(instruction.targets.empty()) // pop
2424
{

src/goto-symex/symex_dead.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Author: Daniel Kroening, [email protected]
1919

2020
void goto_symext::symex_dead(statet &state)
2121
{
22-
const goto_programt::instructiont &instruction=*state.source.pc;
22+
const goto_programt::instructiont &instruction=*state.source.program_counter;
2323

2424
const code_deadt &code = to_code_dead(instruction.code);
2525

0 commit comments

Comments
 (0)