Skip to content

Commit 3eb9e01

Browse files
committed
Use irep_idt() instead of ""
Constructing a dstringt from a C string requires a string table lookup, while the default constructor for a dstringt just zero-initialises an unsigned.
1 parent 388fe2a commit 3eb9e01

21 files changed

+68
-60
lines changed

jbmc/src/java_bytecode/java_object_factory.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,9 @@ void java_object_factoryt::gen_pointer_target_init(
298298
gen_nondet_init(
299299
assignments,
300300
init_expr,
301-
false, // is_sub
302-
"", // class_identifier
303-
false, // skip_classid
301+
false, // is_sub
302+
irep_idt(), // class_identifier
303+
false, // skip_classid
304304
lifetime,
305305
{}, // no override type
306306
depth + 1,
@@ -751,9 +751,9 @@ symbol_exprt java_object_factoryt::gen_nondet_subtype_pointer_init(
751751
gen_nondet_init(
752752
assignments,
753753
new_symbol.symbol_expr(),
754-
false, // is_sub
755-
"", // class_identifier
756-
false, // skip_classid
754+
false, // is_sub
755+
irep_idt(), // class_identifier
756+
false, // skip_classid
757757
lifetime,
758758
{}, // no override_type
759759
depth,
@@ -1555,9 +1555,9 @@ exprt object_factory(
15551555
state.gen_nondet_init(
15561556
assignments,
15571557
object,
1558-
false, // is_sub
1559-
"", // class_identifier
1560-
false, // skip_classid
1558+
false, // is_sub
1559+
irep_idt(), // class_identifier
1560+
false, // skip_classid
15611561
lifetime,
15621562
{}, // no override_type
15631563
1, // initial depth
@@ -1626,8 +1626,8 @@ void gen_nondet_init(
16261626
state.gen_nondet_init(
16271627
assignments,
16281628
expr,
1629-
false, // is_sub
1630-
"", // class_identifier
1629+
false, // is_sub
1630+
irep_idt(), // class_identifier
16311631
skip_classid,
16321632
lifetime,
16331633
{}, // no override_type

jbmc/src/java_bytecode/java_string_library_preprocess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static irep_idt get_tag(const typet &type)
4141
else if(type.id() == ID_struct)
4242
return irep_idt("java::" + id2string(to_struct_type(type).get_tag()));
4343
else
44-
return "";
44+
return irep_idt();
4545
}
4646

4747
/// \param type: a type

src/analyses/ai.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class ai_baset
157157
const goto_functionst::goto_functiont &goto_function,
158158
std::ostream &out) const
159159
{
160-
output(ns, "", goto_function.body, out);
160+
output(ns, irep_idt(), goto_function.body, out);
161161
}
162162

163163
/// Output the abstract states for the whole program as JSON
@@ -178,15 +178,15 @@ class ai_baset
178178
const namespacet &ns,
179179
const goto_programt &goto_program) const
180180
{
181-
return output_json(ns, "", goto_program);
181+
return output_json(ns, irep_idt(), goto_program);
182182
}
183183

184184
/// Output the abstract states for a single function as JSON
185185
jsont output_json(
186186
const namespacet &ns,
187187
const goto_functionst::goto_functiont &goto_function) const
188188
{
189-
return output_json(ns, "", goto_function.body);
189+
return output_json(ns, irep_idt(), goto_function.body);
190190
}
191191

192192
/// Output the abstract states for the whole program as XML
@@ -207,15 +207,15 @@ class ai_baset
207207
const namespacet &ns,
208208
const goto_programt &goto_program) const
209209
{
210-
return output_xml(ns, "", goto_program);
210+
return output_xml(ns, irep_idt(), goto_program);
211211
}
212212

213213
/// Output the abstract states for a single function as XML
214214
xmlt output_xml(
215215
const namespacet &ns,
216216
const goto_functionst::goto_functiont &goto_function) const
217217
{
218-
return output_xml(ns, "", goto_function.body);
218+
return output_xml(ns, irep_idt(), goto_function.body);
219219
}
220220

221221
protected:

src/analyses/goto_rw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ void guarded_range_domaint::output(
671671
out << itr->first << ":" << itr->second.first;
672672
// we don't know what mode (language) we are in, so we rely on the default
673673
// language to be reasonable for from_expr
674-
out << " if " << from_expr(ns, "", itr->second.second);
674+
out << " if " << from_expr(ns, irep_idt(), itr->second.second);
675675
}
676676
out << "]";
677677
}

src/analyses/invariant_set.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ std::string inv_object_storet::build_string(const exprt &expr) const
136136
// we don't know what mode (language) we are in, so we rely on the default
137137
// language to be reasonable for from_expr
138138
if(is_constant_address(expr))
139-
return from_expr(ns, "", expr);
139+
return from_expr(ns, irep_idt(), expr);
140140

141141
if(expr.id()==ID_member)
142142
{
@@ -390,8 +390,8 @@ void invariant_sett::strengthen_rec(const exprt &expr)
390390
throw "non-Boolean argument to strengthen()";
391391

392392
#if 0
393-
std::cout << "S: " << from_expr(*ns, "", expr) << '\n';
394-
#endif
393+
std::cout << "S: " << from_expr(*ns, irep_idt(), expr) << '\n';
394+
#endif
395395

396396
if(is_false)
397397
{
@@ -593,8 +593,8 @@ tvt invariant_sett::implies_rec(const exprt &expr) const
593593
throw "implies: non-Boolean expression";
594594

595595
#if 0
596-
std::cout << "I: " << from_expr(*ns, "", expr) << '\n';
597-
#endif
596+
std::cout << "I: " << from_expr(*ns, irep_idt(), expr) << '\n';
597+
#endif
598598

599599
if(is_false) // can't get any stronger
600600
return tvt(true);

src/analyses/local_bitvector_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void local_bitvector_analysist::output(
347347
}
348348

349349
out << "\n";
350-
goto_function.body.output_instruction(ns, "", out, *i_it);
350+
goto_function.body.output_instruction(ns, irep_idt(), out, *i_it);
351351
out << "\n";
352352

353353
l++;

src/analyses/local_may_alias.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ void local_may_aliast::output(
470470
}
471471

472472
out << "\n";
473-
goto_function.body.output_instruction(ns, "", out, *i_it);
473+
goto_function.body.output_instruction(ns, irep_idt(), out, *i_it);
474474
out << "\n";
475475

476476
l++;

src/analyses/local_safe_pointers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void local_safe_pointerst::output(
207207
}
208208

209209
out << '\n';
210-
goto_program.output_instruction(ns, "", out, *i_it);
210+
goto_program.output_instruction(ns, irep_idt(), out, *i_it);
211211
out << '\n';
212212
}
213213
}
@@ -258,7 +258,7 @@ void local_safe_pointerst::output_safe_dereferences(
258258
}
259259

260260
out << '\n';
261-
goto_program.output_instruction(ns, "", out, *i_it);
261+
goto_program.output_instruction(ns, irep_idt(), out, *i_it);
262262
out << '\n';
263263
}
264264
}

src/analyses/static_analysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class static_analysis_baset
155155
const goto_programt &goto_program,
156156
std::ostream &out) const
157157
{
158-
output(goto_program, "", out);
158+
output(goto_program, irep_idt(), out);
159159
}
160160

161161
virtual bool has_location(locationt l) const=0;

src/ansi-c/c_preprocess.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ static void error_parse_line(
200200
if(state==2)
201201
{
202202
saved_error_location.set_file(file);
203-
saved_error_location.set_function("");
203+
saved_error_location.set_function(irep_idt());
204204
saved_error_location.set_line(line_no);
205-
saved_error_location.set_column("");
205+
saved_error_location.set_column(irep_idt());
206206
}
207207
}
208208

src/goto-instrument/accelerate/acceleration_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ bool acceleration_utilst::check_inductive(
157157

158158
#ifdef DEBUG
159159
std::cout << "Checking following program for inductiveness:\n";
160-
program.output(ns, "", std::cout);
160+
program.output(ns, irep_idt(), std::cout);
161161
#endif
162162

163163
try
@@ -441,7 +441,7 @@ bool acceleration_utilst::do_assumptions(
441441

442442
#ifdef DEBUG
443443
std::cout << "Checking following program for monotonicity:\n";
444-
program.output(ns, "", std::cout);
444+
program.output(ns, irep_idt(), std::cout);
445445
#endif
446446

447447
try

src/goto-instrument/accelerate/polynomial_accelerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ bool polynomial_acceleratort::fit_polynomial_sliced(
403403

404404
#ifdef DEBUG
405405
std::cout << "Fitting polynomial with program:\n";
406-
program.output(ns, "", std::cout);
406+
program.output(ns, irep_idt(), std::cout);
407407
#endif
408408

409409
// Now do an ASSERT(false) to grab a counterexample
@@ -699,7 +699,7 @@ bool polynomial_acceleratort::check_inductive(
699699

700700
#ifdef DEBUG
701701
std::cout << "Checking following program for inductiveness:\n";
702-
program.output(ns, "", std::cout);
702+
program.output(ns, irep_idt(), std::cout);
703703
#endif
704704

705705
try

src/goto-instrument/wmm/cycle_collection.cpp

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,17 @@ void event_grapht::graph_explorert::collect_cycles(
8989
{
9090
event_idt source=*st_it;
9191
egraph.message.debug() << "explore " << egraph[source].id << messaget::eom;
92-
backtrack(set_of_cycles, source, source,
93-
false, max_po_trans, false, false, false, "", model);
92+
backtrack(
93+
set_of_cycles,
94+
source,
95+
source,
96+
false,
97+
max_po_trans,
98+
false,
99+
false,
100+
false,
101+
irep_idt(),
102+
model);
94103

95104
while(!marked_stack.empty())
96105
{
@@ -452,18 +461,17 @@ bool event_grapht::graph_explorert::backtrack(
452461
f=true;
453462
}
454463
else if(!mark[w])
455-
f|=
456-
backtrack(
457-
set_of_cycles,
458-
source,
459-
w,
460-
unsafe_met_updated,
461-
po_trans,
462-
false,
463-
false,
464-
false,
465-
"",
466-
model);
464+
f |= backtrack(
465+
set_of_cycles,
466+
source,
467+
w,
468+
unsafe_met_updated,
469+
po_trans,
470+
false,
471+
false,
472+
false,
473+
irep_idt(),
474+
model);
467475
}
468476
}
469477

src/goto-programs/goto_inline_class.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ void goto_inlinet::expand_function_call(
327327

328328
#ifdef DEBUG
329329
std::cout << "Expanding call:\n";
330-
dest.output_instruction(ns, "", std::cout, *target);
330+
dest.output_instruction(ns, irep_idt(), std::cout, *target);
331331
#endif
332332

333333
exprt lhs;

src/goto-programs/goto_program.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ class goto_programt
725725
/// Output goto-program to given stream
726726
std::ostream &output(std::ostream &out) const
727727
{
728-
return output(namespacet(symbol_tablet()), "", out);
728+
return output(namespacet(symbol_tablet()), irep_idt(), out);
729729
}
730730

731731
/// Output a single instruction

src/goto-symex/symex_builtin_functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ irep_idt get_string_argument_rec(const exprt &src)
295295
}
296296
}
297297

298-
return "";
298+
return irep_idt();
299299
}
300300

301301
irep_idt get_string_argument(const exprt &src, const namespacet &ns)

src/goto-symex/symex_dereference_state.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ void symex_dereference_statet::get_value_set(
9191
#endif
9292

9393
#if 0
94-
std::cout << "E: " << from_expr(goto_symex.ns, "", expr) << '\n';
94+
std::cout << "E: " << from_expr(goto_symex.ns, irep_idt(), expr) << '\n';
9595
#endif
9696

9797
#if 0
9898
std::cout << "**************************\n";
9999
for(value_setst::valuest::const_iterator it=value_set.begin();
100100
it!=value_set.end();
101101
it++)
102-
std::cout << from_expr(goto_symex.ns, "", *it) << '\n';
102+
std::cout << from_expr(goto_symex.ns, irep_idt(), *it) << '\n';
103103
std::cout << "**************************\n";
104104
#endif
105105
}

src/jsil/jsil_language.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ bool jsil_languaget::to_expr(
134134
// parsing
135135

136136
jsil_parser.clear();
137-
jsil_parser.set_file("");
137+
jsil_parser.set_file(irep_idt());
138138
jsil_parser.in=&instream;
139139
jsil_parser.set_message_handler(get_message_handler());
140140
jsil_scanner_init();

src/langapi/language_util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ std::string type_to_name(
5959
std::string from_expr(const exprt &expr)
6060
{
6161
symbol_tablet symbol_table;
62-
return from_expr(namespacet(symbol_table), "", expr);
62+
return from_expr(namespacet(symbol_table), irep_idt(), expr);
6363
}
6464

6565
std::string from_type(const typet &type)
6666
{
6767
symbol_tablet symbol_table;
68-
return from_type(namespacet(symbol_table), "", type);
68+
return from_type(namespacet(symbol_table), irep_idt(), type);
6969
}
7070

7171
exprt to_expr(
@@ -91,5 +91,5 @@ exprt to_expr(
9191
std::string type_to_name(const typet &type)
9292
{
9393
symbol_tablet symbol_table;
94-
return type_to_name(namespacet(symbol_table), "", type);
94+
return type_to_name(namespacet(symbol_table), irep_idt(), type);
9595
}

src/linking/linking.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ void linkingt::detailed_conflict_report_rec(
358358
if(!msg.empty())
359359
{
360360
error() << '\n';
361-
error() << "reason for conflict at " << expr_to_string("", conflict_path)
362-
<< ": " << msg << '\n';
361+
error() << "reason for conflict at "
362+
<< expr_to_string(irep_idt(), conflict_path) << ": " << msg << '\n';
363363

364364
error() << '\n';
365365
error() << type_to_string_verbose(old_symbol, t1) << '\n';

src/util/expr_initializer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ optionalt<exprt> expr_initializert<nondet>::expr_initializer_rec(
242242
if(!found)
243243
{
244244
// stupid empty union
245-
union_exprt value("", nil_exprt(), type);
245+
union_exprt value(irep_idt(), nil_exprt(), type);
246246
value.add_source_location() = source_location;
247247
return std::move(value);
248248
}

0 commit comments

Comments
 (0)