Skip to content

Commit b2729f9

Browse files
author
Daniel Kroening
committed
typing of cpp_typecheckt::add_this_to_method_type
1 parent 8edb663 commit b2729f9

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
@@ -1285,10 +1285,7 @@ void cpp_typecheckt::typecheck_member_function(
12851285
}
12861286
else
12871287
{
1288-
add_this_to_method_type(
1289-
compound_symbol.name,
1290-
type,
1291-
method_qualifier);
1288+
add_this_to_method_type(compound_symbol, type, method_qualifier);
12921289
}
12931290

12941291
if(value.id() == ID_cpp_not_typechecked && value.has_operands())
@@ -1346,11 +1343,11 @@ void cpp_typecheckt::typecheck_member_function(
13461343
}
13471344

13481345
void cpp_typecheckt::add_this_to_method_type(
1349-
const irep_idt &compound_symbol,
1350-
typet &type,
1346+
const symbolt &compound_symbol,
1347+
code_typet &type,
13511348
const typet &method_qualifier)
13521349
{
1353-
code_typet::parameterst &parameters=to_code_type(type).parameters();
1350+
code_typet::parameterst &parameters = type.parameters();
13541351

13551352
parameters.insert(
13561353
parameters.begin(), code_typet::parametert());
@@ -1361,7 +1358,7 @@ void cpp_typecheckt::add_this_to_method_type(
13611358
parameter.set_base_name(ID_this);
13621359
parameter.set_this();
13631360

1364-
typet subtype=symbol_typet(compound_symbol);
1361+
typet subtype = symbol_typet(compound_symbol.name);
13651362

13661363
if(has_const(method_qualifier))
13671364
subtype.set(ID_C_constant, true);

0 commit comments

Comments
 (0)