Skip to content

Commit 6d6b162

Browse files
authored
Merge pull request #3736 from tautschnig/simp-json-remove-follow
Remove unnecessary ns.follow in simplify_json_expr
2 parents 2c0ba69 + ee23ccf commit 6d6b162

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/goto-programs/json_expr.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ Author: Peter Schrammel
2727

2828
#include <memory>
2929

30-
static exprt simplify_json_expr(const exprt &src, const namespacet &ns)
30+
static exprt simplify_json_expr(const exprt &src)
3131
{
3232
if(src.id() == ID_constant)
3333
{
34-
const typet &type = ns.follow(src.type());
35-
36-
if(type.id() == ID_pointer)
34+
if(src.type().id() == ID_pointer)
3735
{
3836
const constant_exprt &c = to_constant_expr(src);
3937

@@ -44,7 +42,7 @@ static exprt simplify_json_expr(const exprt &src, const namespacet &ns)
4442
to_unary_expr(src).op().id() != ID_constant)
4543
// try to simplify the constant pointer
4644
{
47-
return simplify_json_expr(to_unary_expr(src).op(), ns);
45+
return simplify_json_expr(to_unary_expr(src).op());
4846
}
4947
}
5048
}
@@ -56,7 +54,7 @@ static exprt simplify_json_expr(const exprt &src, const namespacet &ns)
5654
.find("@") != std::string::npos)
5755
{
5856
// simplify expressions of the form &member_expr(object, @class_identifier)
59-
return simplify_json_expr(to_address_of_expr(src).object(), ns);
57+
return simplify_json_expr(to_address_of_expr(src).object());
6058
}
6159
else if(
6260
src.id() == ID_address_of &&
@@ -68,15 +66,15 @@ static exprt simplify_json_expr(const exprt &src, const namespacet &ns)
6866
{
6967
// simplify expressions of the form &array[0]
7068
return simplify_json_expr(
71-
to_index_expr(to_address_of_expr(src).object()).array(), ns);
69+
to_index_expr(to_address_of_expr(src).object()).array());
7270
}
7371
else if(
7472
src.id() == ID_member &&
7573
id2string(to_member_expr(src).get_component_name()).find("@") !=
7674
std::string::npos)
7775
{
7876
// simplify expressions of the form member_expr(object, @class_identifier)
79-
return simplify_json_expr(to_member_expr(src).struct_op(), ns);
77+
return simplify_json_expr(to_member_expr(src).struct_op());
8078
}
8179

8280
return src;
@@ -287,7 +285,7 @@ json_objectt json(const exprt &expr, const namespacet &ns, const irep_idt &mode)
287285
{
288286
result["name"] = json_stringt("pointer");
289287
result["type"] = json_stringt(type_string);
290-
exprt simpl_expr = simplify_json_expr(expr, ns);
288+
exprt simpl_expr = simplify_json_expr(expr);
291289
if(
292290
simpl_expr.get(ID_value) == ID_NULL ||
293291
// remove typecast on NULL

0 commit comments

Comments
 (0)