Skip to content

Commit 9aac51d

Browse files
committed
Use s.clear() instead of s=""
This avoids string table lookups.
1 parent b537cfc commit 9aac51d

File tree

17 files changed

+30
-30
lines changed

17 files changed

+30
-30
lines changed

jbmc/unit/pointer-analysis/custom_value_set_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ SCENARIO("test_value_set_analysis",
171171
GIVEN("Normal and custom value-set analysis of CustomVSATest::test")
172172
{
173173
config.set_arch("none");
174-
config.main = "";
174+
config.main.clear();
175175

176176
// This classpath is the default, but the config object
177177
// is global and previous unit tests may have altered it

src/ansi-c/expr2c.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,13 @@ std::string expr2ct::convert_rec(
285285
if(width==config.ansi_c.int_width)
286286
{
287287
if(is_signed)
288-
sign_str="";
288+
sign_str.clear();
289289
return q+sign_str+"int"+d;
290290
}
291291
else if(width==config.ansi_c.long_int_width)
292292
{
293293
if(is_signed)
294-
sign_str="";
294+
sign_str.clear();
295295
return q+sign_str+"long int"+d;
296296
}
297297
else if(width==config.ansi_c.char_width)
@@ -302,19 +302,19 @@ std::string expr2ct::convert_rec(
302302
else if(width==config.ansi_c.short_int_width)
303303
{
304304
if(is_signed)
305-
sign_str="";
305+
sign_str.clear();
306306
return q+sign_str+"short int"+d;
307307
}
308308
else if(width==config.ansi_c.long_long_int_width)
309309
{
310310
if(is_signed)
311-
sign_str="";
311+
sign_str.clear();
312312
return q+sign_str+"long long int"+d;
313313
}
314314
else if(width==128)
315315
{
316316
if(is_signed)
317-
sign_str="";
317+
sign_str.clear();
318318
return q + sign_str + "__int128" + d;
319319
}
320320
else

src/cpp/cpp_name.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void cpp_namet::convert(
6666
identifier+=name_component;
6767

6868
if(id=="::")
69-
base_name="";
69+
base_name.clear();
7070
else
7171
base_name+=name_component;
7272
}

src/cpp/cpp_token.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class cpp_tokent
2929
{
3030
kind=0;
3131
data.clear();
32-
text="";
32+
text.clear();
3333
line_no=0;
34-
filename="";
34+
filename.clear();
3535
}
3636

3737
void swap(cpp_tokent &token)

src/cpp/cpp_typecheck_resolve.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ void cpp_typecheck_resolvet::show_identifiers(
12771277
else if(id_expr.id() == ID_pod_constructor)
12781278
{
12791279
out << "constructor ";
1280-
id="";
1280+
id.clear();
12811281
}
12821282
else if(id_expr.id()==ID_template_function_instance)
12831283
{

src/goto-cc/armcc_mode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ int armcc_modet::doit()
129129
}
130130
else
131131
{
132-
compiler.output_file_object="";
132+
compiler.output_file_object.clear();
133133
compiler.output_file_executable="a.out";
134134
}
135135

src/goto-cc/cw_mode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ int cw_modet::doit()
9494
}
9595
else
9696
{
97-
compiler.output_file_object="";
97+
compiler.output_file_object.clear();
9898
compiler.output_file_executable="a.out";
9999
}
100100

src/goto-cc/gcc_mode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ int gcc_modet::doit()
659659
}
660660
else
661661
{
662-
compiler.output_file_object="";
662+
compiler.output_file_object.clear();
663663
compiler.output_file_executable="a.out";
664664
}
665665

@@ -721,14 +721,14 @@ int gcc_modet::doit()
721721
{
722722
language=arg_it->arg;
723723
if(language=="none")
724-
language="";
724+
language.clear();
725725
}
726726
}
727727
else if(has_prefix(arg_it->arg, "-x"))
728728
{
729729
language=std::string(arg_it->arg, 2, std::string::npos);
730730
if(language=="none")
731-
language="";
731+
language.clear();
732732
}
733733
}
734734
}

src/goto-cc/ld_mode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int ld_modet::doit()
123123
}
124124
else
125125
{
126-
compiler.output_file_object = "";
126+
compiler.output_file_object.clear();
127127
compiler.output_file_executable = "a.out";
128128
}
129129

src/goto-cc/ms_cl_cmdline.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ void ms_cl_cmdlinet::process_cl_option(const std::string &s)
434434
if(s.size()==2)
435435
{
436436
option.islong=false;
437-
option.optstring="";
437+
option.optstring.clear();
438438
option.optchar=s[1];
439439
optnr=getoptnr(option.optchar);
440440
}
@@ -470,7 +470,7 @@ void ms_cl_cmdlinet::process_cl_option(const std::string &s)
470470
if(ms_cl_prefix.size()==1)
471471
{
472472
option.islong=false;
473-
option.optstring="";
473+
option.optstring.clear();
474474
option.optchar=ms_cl_prefix[0];
475475
optnr=getoptnr(option.optchar);
476476
}

0 commit comments

Comments
 (0)