Skip to content

Commit dc1c29d

Browse files
author
Daniel Kroening
committed
typing of cpp_typecheckt::add_this_to_method_type
1 parent 4769ad8 commit dc1c29d

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/cpp/cpp_declarator_converter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ symbolt &cpp_declarator_convertert::convert(
105105
// adjust type if it's a non-static member function
106106
if(final_type.id()==ID_code)
107107
cpp_typecheck.add_this_to_method_type(
108-
scope->identifier, final_type, method_qualifier);
108+
cpp_typecheck.lookup(scope->identifier),
109+
to_code_type(final_type),
110+
method_qualifier);
109111

110112
get_final_identifier();
111113

src/cpp/cpp_typecheck.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ class cpp_typecheckt:public c_typecheck_baset
402402
exprt &value);
403403

404404
void add_this_to_method_type(
405-
const irep_idt &compound_identifier,
406-
typet &method_type,
405+
const symbolt &compound_symbol,
406+
code_typet &method_type,
407407
const typet &method_qualifier);
408408

409409
// for function overloading

src/cpp/cpp_typecheck_compound_type.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,10 +1283,7 @@ void cpp_typecheckt::typecheck_member_function(
12831283
}
12841284
else
12851285
{
1286-
add_this_to_method_type(
1287-
compound_symbol.name,
1288-
type,
1289-
method_qualifier);
1286+
add_this_to_method_type(compound_symbol, type, method_qualifier);
12901287
}
12911288

12921289
if(value.id() == ID_cpp_not_typechecked && value.has_operands())
@@ -1344,11 +1341,11 @@ void cpp_typecheckt::typecheck_member_function(
13441341
}
13451342

13461343
void cpp_typecheckt::add_this_to_method_type(
1347-
const irep_idt &compound_symbol,
1348-
typet &type,
1344+
const symbolt &compound_symbol,
1345+
code_typet &type,
13491346
const typet &method_qualifier)
13501347
{
1351-
code_typet::parameterst &parameters=to_code_type(type).parameters();
1348+
code_typet::parameterst &parameters = type.parameters();
13521349

13531350
parameters.insert(
13541351
parameters.begin(), code_typet::parametert());
@@ -1359,7 +1356,7 @@ void cpp_typecheckt::add_this_to_method_type(
13591356
parameter.set_base_name(ID_this);
13601357
parameter.set_this();
13611358

1362-
typet subtype=symbol_typet(compound_symbol);
1359+
typet subtype = symbol_typet(compound_symbol.name);
13631360

13641361
if(has_const(method_qualifier))
13651362
subtype.set(ID_C_constant, true);

0 commit comments

Comments
 (0)