Skip to content

Commit f1bb138

Browse files
committed
Replace use of ns.follow by type_eq
Using ns.follow on both sides of an operator== is better encapsulated in type_eq.
1 parent 8f52d81 commit f1bb138

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/util/allocate_objects.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Author: Daniel Kroening, [email protected]
1313
#include "fresh_symbol.h"
1414
#include "pointer_offset_size.h"
1515
#include "string_constant.h"
16+
#include "type_eq.h"
1617

1718
/// Allocates a new object, either by creating a local variable with automatic
1819
/// lifetime, a global variable with static lifetime, or by dynamically
@@ -183,7 +184,7 @@ exprt allocate_objectst::allocate_dynamic_object(
183184
output_code.add(assign);
184185

185186
exprt malloc_symbol_expr =
186-
ns.follow(malloc_sym.symbol_expr().type()) != ns.follow(target_expr.type())
187+
!type_eq(malloc_sym.symbol_expr().type(), target_expr.type(), ns)
187188
? (exprt)typecast_exprt(malloc_sym.symbol_expr(), target_expr.type())
188189
: malloc_sym.symbol_expr();
189190

@@ -213,8 +214,7 @@ exprt allocate_objectst::allocate_non_dynamic_object(
213214
symbols_created.push_back(&aux_symbol);
214215

215216
exprt aoe =
216-
ns.follow(aux_symbol.symbol_expr().type()) !=
217-
ns.follow(target_expr.type().subtype())
217+
!type_eq(aux_symbol.symbol_expr().type(), target_expr.type().subtype(), ns)
218218
? (exprt)typecast_exprt(
219219
address_of_exprt(aux_symbol.symbol_expr()), target_expr.type())
220220
: address_of_exprt(aux_symbol.symbol_expr());

src/util/simplify_expr_struct.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ bool simplify_exprt::simplify_member(exprt &expr)
200200
else if(op.id()==ID_union && op_type.id()==ID_union)
201201
{
202202
// trivial?
203-
if(ns.follow(to_union_expr(op).op().type())==ns.follow(expr.type()))
203+
if(type_eq(to_union_expr(op).op().type(), expr.type(), ns))
204204
{
205205
exprt tmp=to_union_expr(op).op();
206206
expr.swap(tmp);

0 commit comments

Comments
 (0)