Skip to content

Commit 79e6e97

Browse files
authored
Merge pull request #1482 from diffblue/use-smv_module_instance_typet
Use `smv_module_instance_typet`
2 parents c9aa3a0 + 73595b3 commit 79e6e97

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/smvlang/smv_typecheck.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,20 @@ void smv_typecheckt::flatten_hierarchy(smv_parse_treet::modulet &smv_module)
206206

207207
if(element.is_var() && element.expr.type().id() == ID_smv_module_instance)
208208
{
209-
exprt &inst =
210-
static_cast<exprt &>(static_cast<irept &>(element.expr.type()));
209+
auto &instance = to_smv_module_instance_type(element.expr.type());
211210

212-
for(auto &op : inst.operands())
213-
convert(op);
211+
for(auto &argument : instance.arguments())
212+
convert(argument);
214213

215214
auto instance_base_name =
216215
to_smv_identifier_expr(element.expr).identifier();
217216

218217
instantiate(
219218
smv_module,
220-
inst.get(ID_identifier),
219+
instance.identifier(),
221220
instance_base_name,
222-
inst.operands(),
223-
inst.find_source_location());
221+
instance.arguments(),
222+
instance.source_location());
224223
}
225224
}
226225
}

src/smvlang/smv_types.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Author: Daniel Kroening, dkr@amazon.com
99
#ifndef CPROVER_SMV_TYPES_H
1010
#define CPROVER_SMV_TYPES_H
1111

12+
#include <util/expr.h>
1213
#include <util/type.h>
1314

1415
#include <set>
@@ -90,6 +91,16 @@ class smv_module_instance_typet : public typet
9091
{
9192
set(ID_identifier, _identifier);
9293
}
94+
95+
const exprt::operandst &arguments() const
96+
{
97+
return (const exprt::operandst &)get_sub();
98+
}
99+
100+
exprt::operandst &arguments()
101+
{
102+
return (exprt::operandst &)get_sub();
103+
}
93104
};
94105

95106
/*! \brief Cast a generic typet to a \ref smv_module_instance_typet

0 commit comments

Comments
 (0)