Skip to content

Commit 4aacad2

Browse files
committed
Use s.clear() instead of s=""
This avoids string table lookups.
1 parent 663bf4a commit 4aacad2

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
@@ -281,13 +281,13 @@ std::string expr2ct::convert_rec(
281281
if(width==config.ansi_c.int_width)
282282
{
283283
if(is_signed)
284-
sign_str="";
284+
sign_str.clear();
285285
return q+sign_str+"int"+d;
286286
}
287287
else if(width==config.ansi_c.long_int_width)
288288
{
289289
if(is_signed)
290-
sign_str="";
290+
sign_str.clear();
291291
return q+sign_str+"long int"+d;
292292
}
293293
else if(width==config.ansi_c.char_width)
@@ -298,19 +298,19 @@ std::string expr2ct::convert_rec(
298298
else if(width==config.ansi_c.short_int_width)
299299
{
300300
if(is_signed)
301-
sign_str="";
301+
sign_str.clear();
302302
return q+sign_str+"short int"+d;
303303
}
304304
else if(width==config.ansi_c.long_long_int_width)
305305
{
306306
if(is_signed)
307-
sign_str="";
307+
sign_str.clear();
308308
return q+sign_str+"long long int"+d;
309309
}
310310
else if(width==128)
311311
{
312312
if(is_signed)
313-
sign_str="";
313+
sign_str.clear();
314314
return q + sign_str + "__int128" + d;
315315
}
316316
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
@@ -126,7 +126,7 @@ int armcc_modet::doit()
126126
}
127127
else
128128
{
129-
compiler.output_file_object="";
129+
compiler.output_file_object.clear();
130130
compiler.output_file_executable="a.out";
131131
}
132132

src/goto-cc/cw_mode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int cw_modet::doit()
9191
}
9292
else
9393
{
94-
compiler.output_file_object="";
94+
compiler.output_file_object.clear();
9595
compiler.output_file_executable="a.out";
9696
}
9797

src/goto-cc/gcc_mode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ int gcc_modet::doit()
656656
}
657657
else
658658
{
659-
compiler.output_file_object="";
659+
compiler.output_file_object.clear();
660660
compiler.output_file_executable="a.out";
661661
}
662662

@@ -718,14 +718,14 @@ int gcc_modet::doit()
718718
{
719719
language=arg_it->arg;
720720
if(language=="none")
721-
language="";
721+
language.clear();
722722
}
723723
}
724724
else if(has_prefix(arg_it->arg, "-x"))
725725
{
726726
language=std::string(arg_it->arg, 2, std::string::npos);
727727
if(language=="none")
728-
language="";
728+
language.clear();
729729
}
730730
}
731731
}

src/goto-cc/ld_mode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ int ld_modet::doit()
120120
}
121121
else
122122
{
123-
compiler.output_file_object = "";
123+
compiler.output_file_object.clear();
124124
compiler.output_file_executable = "a.out";
125125
}
126126

src/goto-cc/ms_cl_cmdline.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ void ms_cl_cmdlinet::process_cl_option(const std::string &s)
431431
if(s.size()==2)
432432
{
433433
option.islong=false;
434-
option.optstring="";
434+
option.optstring.clear();
435435
option.optchar=s[1];
436436
optnr=getoptnr(option.optchar);
437437
}
@@ -467,7 +467,7 @@ void ms_cl_cmdlinet::process_cl_option(const std::string &s)
467467
if(ms_cl_prefix.size()==1)
468468
{
469469
option.islong=false;
470-
option.optstring="";
470+
option.optstring.clear();
471471
option.optchar=ms_cl_prefix[0];
472472
optnr=getoptnr(option.optchar);
473473
}

0 commit comments

Comments
 (0)