Merge branch 'dev-ir-ssa' into dev

pull/58/head
Josselin 6 years ago
commit f1a8677629
  1. 22
      slither/slithir/convert.py
  2. 2
      slither/solc_parsing/declarations/function.py

@ -513,7 +513,7 @@ def apply_ir_heuristics(irs, node):
find_references_origin(irs)
reset_variable_number(irs)
#reset_variable_number(irs)
return irs
@ -526,26 +526,6 @@ def find_references_origin(irs):
if isinstance(ir, (Index, Member)):
ir.lvalue.points_to = ir.variable_left
def reset_variable_number(result):
"""
Reset the number associated to slithIR variables
"""
variables = []
for ins in result:
variables += ins.read
if isinstance(ins, OperationWithLValue) and not ins.lvalue in variables:
variables += [ins.lvalue]
tmp_variables = [v for v in variables if isinstance(v, TemporaryVariable)]
for idx in range(len(tmp_variables)):
tmp_variables[idx].index = idx
ref_variables = [v for v in variables if isinstance(v, ReferenceVariable)]
for idx in range(len(ref_variables)):
ref_variables[idx].index = idx
tuple_variables = [v for v in variables if isinstance(v, TupleVariable)]
for idx in range(len(tuple_variables)):
tuple_variables[idx].index = idx
def is_temporary(ins):
return isinstance(ins, (Argument,
TmpNewElementaryType,

@ -19,6 +19,7 @@ from slither.visitors.expression.has_conditional import HasConditional
from slither.utils.expression_manipulations import SplitTernaryExpression
from slither.slithir.utils.variable_number import transform_slithir_vars_to_ssa
logger = logging.getLogger("FunctionSolc")
@ -635,6 +636,7 @@ class FunctionSolc(Function):
def convert_expression_to_slithir(self):
for node in self.nodes:
node.slithir_generation()
transform_slithir_vars_to_ssa(self)
def split_ternary_node(self, node, condition, true_expr, false_expr):

Loading…
Cancel
Save