Skip to content

Commit

Permalink
Merge pull request #3884 from tautschnig/deprecation-parametert
Browse files Browse the repository at this point in the history
Construct parametert in a non-deprecated way [blocks: #3800]
  • Loading branch information
tautschnig authored Jan 22, 2019
2 parents d87f247 + 91b2939 commit 8300e2d
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 26 deletions.
4 changes: 2 additions & 2 deletions jbmc/src/java_bytecode/java_bytecode_convert_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,11 +831,11 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table)

const irep_idt clone_name =
id2string(struct_tag_type_identifier) + ".clone:()Ljava/lang/Object;";
java_method_typet::parametert this_param;
java_method_typet::parametert this_param(
java_reference_type(struct_tag_type));
this_param.set_identifier(id2string(clone_name)+"::this");
this_param.set_base_name(ID_this);
this_param.set_this();
this_param.type() = java_reference_type(struct_tag_type);
const java_method_typet clone_type({this_param}, java_lang_object_type());

parameter_symbolt this_symbol;
Expand Down
3 changes: 1 addition & 2 deletions jbmc/src/java_bytecode/java_bytecode_convert_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,9 @@ void java_bytecode_convert_method_lazy(
if(!m.is_static)
{
java_method_typet::parameterst &parameters = member_type.parameters();
java_method_typet::parametert this_p;
const reference_typet object_ref_type =
java_reference_type(struct_tag_typet(class_symbol.name));
this_p.type()=object_ref_type;
java_method_typet::parametert this_p(object_ref_type);
this_p.set_this();
parameters.insert(parameters.begin(), this_p);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ansi-c/c_typecheck_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,11 @@ void c_typecheck_baset::typecheck_code_type(code_typet &type)
ansi_c_declarationt &declaration=
to_ansi_c_declaration(param);

code_typet::parametert parameter;

// first fix type
code_typet::parametert parameter(
declaration.full_type(declaration.declarator()));
typet &param_type = parameter.type();
param_type = declaration.full_type(declaration.declarator());
std::list<codet> tmp_clean_code;
tmp_clean_code.swap(clean_code); // ignore side-effects
typecheck_type(param_type);
Expand Down
19 changes: 7 additions & 12 deletions src/cpp/cpp_typecheck_compound_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,17 +1349,6 @@ void cpp_typecheckt::add_this_to_method_type(
code_typet &type,
const typet &method_qualifier)
{
code_typet::parameterst &parameters = type.parameters();

parameters.insert(
parameters.begin(), code_typet::parametert());

code_typet::parametert &parameter=parameters.front();

parameter.set_identifier(ID_this); // check? Not qualified
parameter.set_base_name(ID_this);
parameter.set_this();

typet subtype;

if(compound_symbol.type.id() == ID_union)
Expand All @@ -1373,7 +1362,13 @@ void cpp_typecheckt::add_this_to_method_type(
if(has_volatile(method_qualifier))
subtype.set(ID_C_volatile, true);

parameter.type()=pointer_type(subtype);
code_typet::parametert parameter(pointer_type(subtype));
parameter.set_identifier(ID_this); // check? Not qualified
parameter.set_base_name(ID_this);
parameter.set_this();

code_typet::parameterst &parameters = type.parameters();
parameters.insert(parameters.begin(), parameter);
}

void cpp_typecheckt::add_anonymous_members_to_scope(
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5615,7 +5615,7 @@ bool Parser::rTypeNameOrFunctionType(typet &tname)
if(!rArgDeclaration(parameter_declaration))
return false;

code_typet::parametert parameter;
code_typet::parametert parameter(typet{});
parameter.swap(parameter_declaration);
type.parameters().push_back(parameter);

Expand Down
4 changes: 1 addition & 3 deletions src/jsil/jsil_internal_additions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ void jsil_internal_additions(symbol_tablet &dest)
// add eval

{
code_typet eval_type;
code_typet::parametert p;
eval_type.parameters().push_back(p);
code_typet eval_type({code_typet::parametert(typet())}, empty_typet());

symbolt symbol;
symbol.base_name="eval";
Expand Down
8 changes: 4 additions & 4 deletions src/jsil/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ procedure_decl: TOK_PROCEDURE proc_ident '(' parameters_opt ')'
'{' statements_opt '}'
{
symbol_exprt proc(to_symbol_expr(stack($2)));
code_typet ct;
code_typet::parameterst parameters;
forall_operands(it, stack($4))
{
symbol_exprt s(to_symbol_expr(*it));
code_typet::parametert p;
code_typet::parametert p(typet{});
p.set_identifier(s.get_identifier());
ct.parameters().push_back(p);
parameters.push_back(p);
}
proc.type().swap(ct);
proc.type() = code_typet(std::move(parameters), typet());

symbol_exprt rv(to_symbol_expr(stack($7)));
symbol_exprt rl(to_symbol_expr(stack($9)));
Expand Down

0 comments on commit 8300e2d

Please sign in to comment.