Skip to content

Commit d2a0df9

Browse files
authored
Merge pull request #3941 from tautschnig/deprecation-nil_typet-typechecking
Use typet instead of nil_typet during type checking [blocks: #3800, #3907]
2 parents b016d29 + 60e847c commit d2a0df9

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

jbmc/unit/java_bytecode/load_method_by_regex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static symbolt create_method_symbol(const std::string &method_name)
9292
{
9393
symbolt new_symbol;
9494
new_symbol.name = method_name;
95-
new_symbol.type = java_method_typet{{}, nil_typet{}};
95+
new_symbol.type = java_method_typet{{}, typet{}};
9696
return new_symbol;
9797
}
9898

src/cpp/cpp_parse_tree.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@ class cpp_parse_treet
2828
void clear();
2929
};
3030

31+
class uninitialized_typet : public typet
32+
{
33+
public:
34+
uninitialized_typet() : typet(static_cast<const typet &>(get_nil_irep()))
35+
{
36+
}
37+
};
38+
3139
#endif // CPROVER_CPP_CPP_PARSE_TREE_H

src/cpp/cpp_typecheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class cpp_typecheckt:public c_typecheck_baset
216216
const symbolt &symbol,
217217
const cpp_template_args_tct &specialization_template_args,
218218
const cpp_template_args_tct &full_template_args,
219-
const typet &specialization=typet(ID_nil));
219+
const typet &specialization = uninitialized_typet{});
220220

221221
void elaborate_class_template(
222222
const source_locationt &source_location,

src/cpp/cpp_typecheck_constructor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void cpp_typecheckt::default_cpctor(
166166
cpp_declaratort parameter_tor;
167167
parameter_tor.add(ID_value).make_nil();
168168
parameter_tor.set(ID_name, cpp_parameter);
169-
parameter_tor.type()=reference_type(nil_typet());
169+
parameter_tor.type() = reference_type(uninitialized_typet{});
170170
parameter_tor.add_source_location()=source_location;
171171

172172
// Parameter declaration
@@ -308,7 +308,7 @@ void cpp_typecheckt::default_assignop(
308308
declarator_name.get_sub().push_back(irept("="));
309309

310310
declarator_type.id(ID_function_type);
311-
declarator_type.subtype()=reference_type(nil_typet());
311+
declarator_type.subtype() = reference_type(uninitialized_typet{});
312312
declarator_type.subtype().add(ID_C_qualifier).make_nil();
313313

314314
exprt &args=static_cast<exprt&>(declarator.type().add(ID_parameters));
@@ -335,7 +335,7 @@ void cpp_typecheckt::default_assignop(
335335
args_decl_declor.name() = cpp_namet(arg_name, source_location);
336336
args_decl_declor.add_source_location()=source_location;
337337

338-
args_decl_declor.type()=pointer_type(typet(ID_nil));
338+
args_decl_declor.type() = pointer_type(uninitialized_typet{});
339339
args_decl_declor.type().set(ID_C_reference, true);
340340
args_decl_declor.value().make_nil();
341341
}

src/cpp/parse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2206,7 +2206,7 @@ bool Parser::rAttribute(typet &t)
22062206
if(lex.get_token(tk3)!=')')
22072207
return false;
22082208

2209-
vector_typet attr(nil_typet(), exp);
2209+
vector_typet attr(uninitialized_typet{}, exp);
22102210
attr.add_source_location()=exp.source_location();
22112211
merge_types(attr, t);
22122212
break;

src/goto-programs/string_abstraction.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,8 @@ const typet &string_abstractiont::build_abstraction_type_rec(const typet &type,
682682
if(known_entry!=known.end())
683683
return known_entry->second;
684684

685-
::std::pair< abstraction_types_mapt::iterator, bool > map_entry(
686-
abstraction_types_map.insert(::std::make_pair(
687-
eff_type, nil_typet())));
685+
::std::pair<abstraction_types_mapt::iterator, bool> map_entry(
686+
abstraction_types_map.insert(::std::make_pair(eff_type, typet())));
688687
if(!map_entry.second)
689688
return map_entry.first->second;
690689

src/jsil/jsil_parse_tree.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ void jsil_declarationt::to_symbol(symbolt &symbol) const
7070

7171
irept throws(find(ID_throw));
7272
side_effect_expr_throwt t(
73-
symbol_exprt::typeless(throws.get(ID_value)),
74-
nil_typet(),
75-
s.source_location());
73+
symbol_exprt::typeless(throws.get(ID_value)), typet(), s.source_location());
7674
code_expressiont ct(t);
7775

7876
if(insert_at_label(r, returns.get(ID_label), code))

0 commit comments

Comments
 (0)