@@ -35,23 +35,27 @@ def is_condition(self, cfg_node):
35
35
return True
36
36
return False
37
37
38
+ def remove_id_assignment (self , JOIN , cfg_node ):
39
+ lvars = list ()
40
+ try :
41
+ for expr in cfg_node .ast_node .targets :
42
+ vv = VarsVisitor ()
43
+ vv .visit (expr )
44
+ lvars .extend (vv .result )
45
+ except AttributeError : # If it is AugAssign
46
+ vv = VarsVisitor ()
47
+ vv .visit (cfg_node .ast_node .target )
48
+ lvars .extend (vv .result )
49
+
50
+ for var in lvars :
51
+ if var in self .lattice .get_elements (JOIN ): # Check if var in JOIN
52
+ JOIN = JOIN ^ self .lattice .el2bv [var ]
53
+ return JOIN
38
54
def fixpointmethod (self , cfg_node ):
39
55
40
56
if isinstance (cfg_node , EntryExitNode ) and 'Exit' in cfg_node .label :
41
57
constraint_table [cfg_node ] = 0
42
58
elif isinstance (cfg_node , AssignmentNode ):
43
- lvars = list ()
44
- try :
45
- for expr in cfg_node .ast_node .targets :
46
- vv = VarsVisitor ()
47
- vv .visit (expr )
48
- lvars .extend (vv .result )
49
- except AttributeError :
50
- if cfg_node .ast_node :
51
- vv = VarsVisitor ()
52
- vv .visit (cfg_node .ast_node .value )
53
- lvars .extend (vv .result )
54
-
55
59
JOIN = self .join (cfg_node )
56
60
57
61
for var in lvars :
@@ -61,6 +65,7 @@ def fixpointmethod(self, cfg_node):
61
65
for var in cfg_node .right_hand_side_variables :
62
66
JOIN = JOIN | self .lattice .el2bv [var ]
63
67
68
+ JOIN = self .remove_id_assignment (JOIN , cfg_node )
64
69
constraint_table [cfg_node ] = JOIN
65
70
elif self .is_condition (cfg_node ):
66
71
0 commit comments