C++: Fix for multiple for-loop variables with destructors

This commit is contained in:
Robert Marsh
2024-02-13 00:40:19 +00:00
parent 6663420d39
commit 7d8872bb99
9 changed files with 29 additions and 7 deletions

View File

@@ -1019,6 +1019,12 @@ class TranslatedForStmt extends TranslatedLoop {
or
child = this.getUpdate() and result = this.getFirstConditionInstruction(kind)
or
exists(int destructorId |
destructorId >= this.getFirstDestructorCallIndex() and
child = this.getChild(destructorId) and
result = this.getChild(destructorId + 1).getFirstInstruction(kind)
)
or
exists(int lastDestructorIndex |
lastDestructorIndex =
max(int n | exists(this.getChild(n)) and n >= this.getFirstDestructorCallIndex()) and