Skip to content

Commit 1b22b57

Browse files
tautschnigDaniel Kroening
authored and
Daniel Kroening
committed
Replace "this" string literals by ID_this
This avoids typos and may be slightly faster.
1 parent 65a53c2 commit 1b22b57

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

jbmc/src/java_bytecode/expr2java.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ std::string expr2javat::convert_java_this(
314314
const exprt &src,
315315
unsigned precedence)
316316
{
317-
return "this";
317+
return id2string(ID_this);
318318
}
319319

320320
std::string expr2javat::convert_java_instanceof(

jbmc/src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table)
833833
id2string(struct_tag_type_identifier) + ".clone:()Ljava/lang/Object;";
834834
java_method_typet::parametert this_param;
835835
this_param.set_identifier(id2string(clone_name)+"::this");
836-
this_param.set_base_name("this");
836+
this_param.set_base_name(ID_this);
837837
this_param.set_this();
838838
this_param.type() = java_reference_type(struct_tag_type);
839839
const java_method_typet clone_type({this_param}, java_lang_object_type());

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void assign_parameter_names(
9999
irep_idt base_name, identifier;
100100

101101
if(i==0 && parameters[i].get_this())
102-
base_name="this";
102+
base_name = ID_this;
103103
else
104104
base_name="stub_ignored_arg"+std::to_string(i);
105105

@@ -516,7 +516,7 @@ void java_bytecode_convert_methodt::convert(
516516
if(param_index==0 && param.get_this())
517517
{
518518
// my.package.ClassName.myMethodName:(II)I::this
519-
base_name="this";
519+
base_name = ID_this;
520520
identifier=id2string(method_identifier)+"::"+id2string(base_name);
521521
}
522522
else
@@ -2096,7 +2096,7 @@ void java_bytecode_convert_methodt::convert_invoke(
20962096
reference_typet object_ref_type = java_reference_type(thistype);
20972097
java_method_typet::parametert this_p(object_ref_type);
20982098
this_p.set_this();
2099-
this_p.set_base_name("this");
2099+
this_p.set_base_name(ID_this);
21002100
parameters.insert(parameters.begin(), this_p);
21012101
}
21022102
}
@@ -3013,7 +3013,7 @@ void java_bytecode_initialize_parameter_names(
30133013
if(param_index == 0 && param.get_this())
30143014
{
30153015
// my.package.ClassName.myMethodName:(II)I::this
3016-
base_name = "this";
3016+
base_name = ID_this;
30173017
identifier = id2string(method_symbol.name) + "::" + id2string(base_name);
30183018
}
30193019
else

jbmc/unit/java-testing-utils/require_goto_statements.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ require_goto_statements::find_this_component_assignment(
177177
member_expr.op().op0().id() == ID_symbol &&
178178
has_suffix(
179179
id2string(to_symbol_expr(member_expr.op().op0()).get_identifier()),
180-
"this"))
180+
id2string(ID_this)))
181181
{
182182
if(
183183
code_assign.rhs() ==

jbmc/unit/java_bytecode/goto_program_generics/generic_bases_test.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SCENARIO(
4141
// this = &tmp_object_factory$1;
4242
const irep_idt &this_tmp_name =
4343
require_goto_statements::require_entry_point_argument_assignment(
44-
"this", entry_point_code);
44+
ID_this, entry_point_code);
4545

4646
THEN("Object 'this' created has correctly specialized inherited field")
4747
{
@@ -81,7 +81,7 @@ SCENARIO(
8181
// parts of the previous tests.
8282
const auto &this_tmp_name =
8383
require_goto_statements::require_entry_point_argument_assignment(
84-
"this", entry_point_code);
84+
ID_this, entry_point_code);
8585

8686
THEN("Object 'this' has correctly specialized inherited field")
8787
{
@@ -113,7 +113,7 @@ SCENARIO(
113113
// parts of the previous tests.
114114
const auto &this_tmp_name =
115115
require_goto_statements::require_entry_point_argument_assignment(
116-
"this", entry_point_code);
116+
ID_this, entry_point_code);
117117

118118
THEN("Object 'this' has correctly specialized inherited field")
119119
{
@@ -158,7 +158,7 @@ SCENARIO(
158158
// parts of the previous tests.
159159
const auto &this_tmp_name =
160160
require_goto_statements::require_entry_point_argument_assignment(
161-
"this", entry_point_code);
161+
ID_this, entry_point_code);
162162

163163
THEN(
164164
"The object 'this' has field 'f' of type "
@@ -205,7 +205,7 @@ SCENARIO(
205205
// parts of the previous tests.
206206
const auto &this_tmp_name =
207207
require_goto_statements::require_entry_point_argument_assignment(
208-
"this", entry_point_code);
208+
ID_this, entry_point_code);
209209

210210
THEN("The object 'this' has field 'f' of type java::SuperclassMixed")
211211
{
@@ -261,7 +261,7 @@ SCENARIO(
261261
// parts of the previous tests.
262262
const auto &this_tmp_name =
263263
require_goto_statements::require_entry_point_argument_assignment(
264-
"this", entry_point_code);
264+
ID_this, entry_point_code);
265265

266266
THEN(
267267
"The object 'this' has fields 'inner' and 'inner_gen' "
@@ -334,7 +334,7 @@ SCENARIO(
334334
// parts of the previous tests.
335335
const auto &this_tmp_name =
336336
require_goto_statements::require_entry_point_argument_assignment(
337-
"this", entry_point_code);
337+
ID_this, entry_point_code);
338338

339339
THEN(
340340
"The object 'this' has field 'f' of type "
@@ -470,7 +470,7 @@ SCENARIO(
470470
// this = &tmp_object_factory$1;
471471
const irep_idt &this_tmp_name =
472472
require_goto_statements::require_entry_point_argument_assignment(
473-
"this", entry_point_code);
473+
ID_this, entry_point_code);
474474

475475
THEN("Object 'this' created has unspecialized inherited field")
476476
{
@@ -518,7 +518,7 @@ SCENARIO(
518518
// parts of the previous tests.
519519
const irep_idt &this_tmp_name =
520520
require_goto_statements::require_entry_point_argument_assignment(
521-
"this", entry_point_code);
521+
ID_this, entry_point_code);
522522

523523
THEN("Object 'this' created has unspecialized inherited field")
524524
{

jbmc/unit/java_bytecode/goto_program_generics/generic_parameters_test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ SCENARIO(
3939
// this = &tmp_object_factory$1;
4040
const irep_idt &tmp_object_name =
4141
require_goto_statements::require_entry_point_argument_assignment(
42-
"this", entry_point_code);
42+
ID_this, entry_point_code);
4343

4444
THEN("Object 'this' has field 'field_input' of type Wrapper")
4545
{
@@ -102,7 +102,7 @@ SCENARIO(
102102
// for, so we need to extract its identifier, and start looking for that.
103103
const auto &tmp_object_name =
104104
require_goto_statements::require_entry_point_argument_assignment(
105-
"this", entry_point_code);
105+
ID_this, entry_point_code);
106106

107107
THEN("Type of multiple generic fields should be right")
108108
{
@@ -188,7 +188,7 @@ SCENARIO(
188188

189189
const auto &tmp_object_name =
190190
require_goto_statements::require_entry_point_argument_assignment(
191-
"this", entry_point_code);
191+
ID_this, entry_point_code);
192192

193193
THEN("Object 'this' has field 'field_input1' of type Wrapper")
194194
{
@@ -246,7 +246,7 @@ SCENARIO(
246246

247247
const auto &tmp_object_name =
248248
require_goto_statements::require_entry_point_argument_assignment(
249-
"this", entry_point_code);
249+
ID_this, entry_point_code);
250250

251251
THEN("Object 'this' has field 'field_input' of type PairWrapper")
252252
{
@@ -563,7 +563,7 @@ SCENARIO(
563563

564564
const irep_idt &tmp_object_name =
565565
require_goto_statements::require_entry_point_argument_assignment(
566-
"this", entry_point_code);
566+
ID_this, entry_point_code);
567567

568568
THEN("Object 'this' has field 'f' of type UnsupportedWrapper2")
569569
{
@@ -627,7 +627,7 @@ SCENARIO(
627627

628628
const irep_idt &tmp_object_name =
629629
require_goto_statements::require_entry_point_argument_assignment(
630-
"this", entry_point_code);
630+
ID_this, entry_point_code);
631631

632632
THEN("Object 'this' has field 'f' of type OpaqueWrapper")
633633
{

jbmc/unit/java_bytecode/goto_program_generics/mutually_recursive_generics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ SCENARIO(
100100

101101
const irep_idt &tmp_object_name =
102102
require_goto_statements::require_entry_point_argument_assignment(
103-
"this", entry_point_code);
103+
ID_this, entry_point_code);
104104

105105
THEN(
106106
"The Object has a field `example1` of type `KeyValue<String, Integer>`")

src/cpp/cpp_typecheck_function.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ irep_idt cpp_typecheckt::function_identifier(const typet &type)
181181
result += "$const";
182182
if(symbol.get_bool(ID_C_volatile))
183183
result += "$volatile";
184-
result+="this";
184+
result += id2string(ID_this);
185185
first=false;
186186
it++;
187187
}

src/cpp/expr2cpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ std::string expr2cppt::convert_cpp_this(
316316
const exprt &src,
317317
unsigned precedence)
318318
{
319-
return "this";
319+
return id2string(ID_this);
320320
}
321321

322322
std::string expr2cppt::convert_cpp_new(

src/goto-analyzer/taint_parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ bool taint_parser(
8888
{
8989
rule.where=taint_parse_treet::rulet::RETURN_VALUE;
9090
}
91-
else if(where=="this")
91+
else if(where == id2string(ID_this))
9292
{
9393
rule.where=taint_parse_treet::rulet::THIS;
9494
}

0 commit comments

Comments
 (0)