Skip to content

Commit a83a5fc

Browse files
author
Daniel Kroening
committed
add missing const qualifiers
This prevents accidental disruption of sharing.
1 parent a4aaaf5 commit a83a5fc

File tree

5 files changed

+34
-34
lines changed

5 files changed

+34
-34
lines changed

jbmc/src/java_bytecode/remove_exceptions.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ bool remove_exceptionst::instrument_function_call(
434434
goto_programt::targett next_it=instr_it;
435435
next_it++;
436436

437-
code_function_callt &function_call = instr_it->get_function_call();
437+
const code_function_callt &function_call = instr_it->get_function_call();
438+
438439
DATA_INVARIANT(
439440
function_call.function().id()==ID_symbol,
440441
"identified expected to be a symbol");

src/goto-instrument/accelerate/accelerate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ void acceleratet::add_dirty_checks()
380380
// variables is clean _before_ clearing any dirty flags.
381381
if(it->is_assign())
382382
{
383-
exprt &lhs = it->get_assign().lhs();
383+
const exprt &lhs = it->get_assign().lhs();
384384
expr_mapt::iterator dirty_var=dirty_vars_map.find(lhs);
385385

386386
if(dirty_var!=dirty_vars_map.end())

src/goto-programs/parameter_assignments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void parameter_assignmentst::do_function_calls(
4242
{
4343
if(i_it->is_function_call())
4444
{
45-
code_function_callt &function_call = i_it->get_function_call();
45+
const code_function_callt &function_call = i_it->get_function_call();
4646

4747
// add x=y for f(y) where x is the parameter
4848

src/goto-programs/string_abstraction.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,13 +1046,13 @@ void string_abstractiont::move_lhs_arithmetic(exprt &lhs, exprt &rhs)
10461046

10471047
goto_programt::targett string_abstractiont::abstract_pointer_assign(
10481048
goto_programt &dest,
1049-
goto_programt::targett target)
1049+
const goto_programt::targett target)
10501050
{
1051-
code_assignt &assign = target->get_assign();
1051+
const code_assignt &assign = target->get_assign();
10521052

1053-
exprt &lhs=assign.lhs();
1054-
exprt rhs=assign.rhs();
1055-
exprt *rhsp=&(assign.rhs());
1053+
const exprt &lhs = assign.lhs();
1054+
const exprt rhs = assign.rhs();
1055+
const exprt *rhsp = &(assign.rhs());
10561056

10571057
while(rhsp->id()==ID_typecast)
10581058
rhsp=&(rhsp->op0());
@@ -1077,9 +1077,8 @@ goto_programt::targett string_abstractiont::abstract_pointer_assign(
10771077
code_assignt(new_lhs, new_rhs), target->source_location);
10781078
assignment.code.add_source_location()=target->source_location;
10791079
dest.insert_before_swap(target, assignment);
1080-
++target;
10811080

1082-
return target;
1081+
return std::next(target);
10831082
}
10841083
else
10851084
{
@@ -1091,10 +1090,10 @@ goto_programt::targett string_abstractiont::abstract_char_assign(
10911090
goto_programt &dest,
10921091
goto_programt::targett target)
10931092
{
1094-
code_assignt &assign = target->get_assign();
1093+
const code_assignt &assign = target->get_assign();
10951094

1096-
exprt &lhs=assign.lhs();
1097-
exprt *rhsp=&(assign.rhs());
1095+
const exprt &lhs = assign.lhs();
1096+
const exprt *rhsp = &(assign.rhs());
10981097

10991098
while(rhsp->id()==ID_typecast)
11001099
rhsp=&(rhsp->op0());

src/goto-programs/string_instrumentation.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,43 +84,43 @@ class string_instrumentationt:public messaget
8484
void do_sprintf(
8585
goto_programt &dest,
8686
goto_programt::targett it,
87-
code_function_callt &call);
87+
const code_function_callt &);
8888
void do_snprintf(
8989
goto_programt &dest,
9090
goto_programt::targett it,
91-
code_function_callt &call);
91+
const code_function_callt &);
9292
void do_strcat(
9393
goto_programt &dest,
9494
goto_programt::targett it,
95-
code_function_callt &call);
95+
const code_function_callt &);
9696
void do_strncmp(
9797
goto_programt &dest,
9898
goto_programt::targett it,
99-
code_function_callt &call);
99+
const code_function_callt &);
100100
void do_strchr(
101101
goto_programt &dest,
102102
goto_programt::targett it,
103-
code_function_callt &call);
103+
const code_function_callt &);
104104
void do_strrchr(
105105
goto_programt &dest,
106106
goto_programt::targett it,
107-
code_function_callt &call);
107+
const code_function_callt &);
108108
void do_strstr(
109109
goto_programt &dest,
110110
goto_programt::targett it,
111-
code_function_callt &call);
111+
const code_function_callt &);
112112
void do_strtok(
113113
goto_programt &dest,
114114
goto_programt::targett it,
115-
code_function_callt &call);
115+
const code_function_callt &);
116116
void do_strerror(
117117
goto_programt &dest,
118118
goto_programt::targett it,
119-
code_function_callt &call);
119+
const code_function_callt &);
120120
void do_fscanf(
121121
goto_programt &dest,
122122
goto_programt::targett it,
123-
code_function_callt &call);
123+
const code_function_callt &);
124124

125125
void do_format_string_read(
126126
goto_programt &dest,
@@ -222,8 +222,8 @@ void string_instrumentationt::do_function_call(
222222
goto_programt &dest,
223223
goto_programt::targett target)
224224
{
225-
code_function_callt &call = target->get_function_call();
226-
exprt &function=call.function();
225+
const code_function_callt &call = target->get_function_call();
226+
const exprt &function = call.function();
227227
// const exprt &lhs=call.lhs();
228228

229229
if(function.id()==ID_symbol)
@@ -272,7 +272,7 @@ void string_instrumentationt::do_function_call(
272272
void string_instrumentationt::do_sprintf(
273273
goto_programt &dest,
274274
goto_programt::targett target,
275-
code_function_callt &call)
275+
const code_function_callt &call)
276276
{
277277
const code_function_callt::argumentst &arguments=call.arguments();
278278

@@ -312,7 +312,7 @@ void string_instrumentationt::do_sprintf(
312312
void string_instrumentationt::do_snprintf(
313313
goto_programt &dest,
314314
goto_programt::targett target,
315-
code_function_callt &call)
315+
const code_function_callt &call)
316316
{
317317
const code_function_callt::argumentst &arguments=call.arguments();
318318

@@ -353,7 +353,7 @@ void string_instrumentationt::do_snprintf(
353353
void string_instrumentationt::do_fscanf(
354354
goto_programt &dest,
355355
goto_programt::targett target,
356-
code_function_callt &call)
356+
const code_function_callt &call)
357357
{
358358
const code_function_callt::argumentst &arguments=call.arguments();
359359

@@ -618,14 +618,14 @@ void string_instrumentationt::do_format_string_write(
618618
void string_instrumentationt::do_strncmp(
619619
goto_programt &,
620620
goto_programt::targett,
621-
code_function_callt &)
621+
const code_function_callt &)
622622
{
623623
}
624624

625625
void string_instrumentationt::do_strchr(
626626
goto_programt &dest,
627627
goto_programt::targett target,
628-
code_function_callt &call)
628+
const code_function_callt &call)
629629
{
630630
const code_function_callt::argumentst &arguments=call.arguments();
631631

@@ -650,7 +650,7 @@ void string_instrumentationt::do_strchr(
650650
void string_instrumentationt::do_strrchr(
651651
goto_programt &dest,
652652
goto_programt::targett target,
653-
code_function_callt &call)
653+
const code_function_callt &call)
654654
{
655655
const code_function_callt::argumentst &arguments=call.arguments();
656656

@@ -675,7 +675,7 @@ void string_instrumentationt::do_strrchr(
675675
void string_instrumentationt::do_strstr(
676676
goto_programt &dest,
677677
goto_programt::targett target,
678-
code_function_callt &call)
678+
const code_function_callt &call)
679679
{
680680
const code_function_callt::argumentst &arguments=call.arguments();
681681

@@ -706,7 +706,7 @@ void string_instrumentationt::do_strstr(
706706
void string_instrumentationt::do_strtok(
707707
goto_programt &dest,
708708
goto_programt::targett target,
709-
code_function_callt &call)
709+
const code_function_callt &call)
710710
{
711711
const code_function_callt::argumentst &arguments=call.arguments();
712712

@@ -737,7 +737,7 @@ void string_instrumentationt::do_strtok(
737737
void string_instrumentationt::do_strerror(
738738
goto_programt &dest,
739739
goto_programt::targett it,
740-
code_function_callt &call)
740+
const code_function_callt &call)
741741
{
742742
if(call.lhs().is_nil())
743743
{

0 commit comments

Comments
 (0)