Skip to content

Commit 315dcb8

Browse files
committed
Fix performance of multi_assignment_points_to.
1 parent a40f0e0 commit 315dcb8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

python/ql/src/semmle/python/pointsto/PointsTo.qll

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,17 @@ cached module PointsToInternal {
500500
pointsTo(def.getValue(), context, value, origin)
501501
}
502502

503+
pragma [nomagic]
504+
private predicate sequence_index_points_to(ControlFlowNode f, PointsToContext context, SequenceObjectInternal sequence, ObjectInternal value, int index) {
505+
pointsTo(f, context, sequence, _) and
506+
value = sequence.getItem(index)
507+
}
508+
503509
pragma [noinline]
504510
private predicate multi_assignment_points_to(MultiAssignmentDefinition def, PointsToContext context, ObjectInternal value, ControlFlowNode origin) {
505511
exists(int index, ControlFlowNode rhs, SequenceObjectInternal sequence |
506512
def.indexOf(index, rhs) and
507-
pointsTo(rhs, context, sequence, _) and
508-
value = sequence.getItem(index) and
513+
sequence_index_points_to(rhs, context, sequence, value, index) and
509514
origin = def.getDefiningNode()
510515
)
511516
}

0 commit comments

Comments
 (0)