Skip to content

Commit d0c9bd3

Browse files
committed
get rid of typet(ID_pointer)
1 parent 4577401 commit d0c9bd3

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

src/cpp/cpp_constructor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,8 @@ codet cpp_typecheckt::cpp_constructor(
289289
assert(tmp_this.id()==ID_address_of
290290
&& tmp_this.op0().id()=="new_object");
291291

292-
exprt address_of(ID_address_of, typet(ID_pointer));
293-
address_of.type().subtype()=object_tc.type();
294-
address_of.copy_to_operands(object_tc);
292+
exprt address_of=
293+
address_of_exprt(object_tc, pointer_type(object_tc.type()));
295294
tmp_this.swap(address_of);
296295

297296
if(block.operands().empty())

src/cpp/cpp_destructor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ codet cpp_typecheckt::cpp_destructor(
142142
assert(tmp_this.id()==ID_address_of
143143
&& tmp_this.op0().id()=="new_object");
144144

145-
exprt address_of(ID_address_of, typet(ID_pointer));
146-
address_of.type().subtype()=object.type();
147-
address_of.copy_to_operands(object);
145+
exprt address_of=
146+
address_of_exprt(object, pointer_type(object.type()));
147+
148148
tmp_this.swap(address_of);
149149

150150
new_code.swap(initializer);

src/cpp/cpp_typecheck_expr.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,7 @@ void cpp_typecheckt::typecheck_expr_address_of(exprt &expr)
722722
// we take the address of the method.
723723
assert(expr.op0().id()==ID_member);
724724
exprt symb=cpp_symbol_expr(lookup(expr.op0().get(ID_component_name)));
725-
exprt address(ID_address_of, typet(ID_pointer));
726-
address.copy_to_operands(symb);
727-
address.type().subtype()=symb.type();
725+
address_of_exprt address(symb, pointer_type(symb.type()));
728726
address.set(ID_C_implicit, true);
729727
expr.op0().swap(address);
730728
}
@@ -2255,10 +2253,8 @@ void cpp_typecheckt::typecheck_side_effect_function_call(
22552253
if(operand.type().id()!=ID_pointer &&
22562254
operand.type()==argument.type().subtype())
22572255
{
2258-
exprt tmp(ID_address_of, typet(ID_pointer));
2259-
tmp.type().subtype()=operand.type();
2256+
exprt tmp=address_of_exprt(operand, pointer_type(operand.type()));
22602257
tmp.add_source_location()=operand.source_location();
2261-
tmp.move_to_operands(operand);
22622258
operand.swap(tmp);
22632259
}
22642260
}
@@ -2671,9 +2667,8 @@ void cpp_typecheckt::convert_pmop(exprt &expr)
26712667
else
26722668
{
26732669
assert(expr.op0().get_bool(ID_C_lvalue));
2674-
exprt address_of(ID_address_of, typet(ID_pointer));
2675-
address_of.copy_to_operands(expr.op0());
2676-
address_of.type().subtype()=address_of.op0().type();
2670+
exprt address_of=
2671+
address_of_exprt(expr.op0(), pointer_type(expr.op0().type()));
26772672
expr.op0().swap(address_of);
26782673
}
26792674
}

src/goto-programs/remove_exceptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void remove_exceptionst::add_exceptional_returns(
108108
new_symbol.base_name=id2string(function_symbol.base_name)+EXC_SUFFIX;
109109
new_symbol.name=id2string(function_symbol.name)+EXC_SUFFIX;
110110
new_symbol.mode=function_symbol.mode;
111-
new_symbol.type=typet(ID_pointer, empty_typet());
111+
new_symbol.type=pointer_typet(empty_typet());
112112
symbol_table.add(new_symbol);
113113

114114
// initialize the exceptional return with NULL

src/java_bytecode/java_entry_point.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ bool java_entry_point(
556556
exc_symbol.is_static_lifetime=false;
557557
exc_symbol.name=id2string(symbol.name)+EXC_SUFFIX;
558558
exc_symbol.base_name=id2string(symbol.name)+EXC_SUFFIX;
559-
exc_symbol.type=typet(ID_pointer, empty_typet());
559+
exc_symbol.type=java_reference_type(empty_typet());
560560
symbol_table.add(exc_symbol);
561561

562562
exprt::operandst main_arguments=

0 commit comments

Comments
 (0)