Skip to content

Commit 1808886

Browse files
committed
C++: Properly handle the case where a TranslatedElement has no children.
1 parent 805b4d6 commit 1808886

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ abstract class TranslatedExpr extends TranslatedElement {
9090
final override TranslatedElement getChild(int id) {
9191
result = this.getChildInternal(id)
9292
or
93-
exists(int maxChildId, int destructorIndex |
94-
maxChildId = max(int childId | exists(this.getChildInternal(childId))) and
93+
exists(int destructorIndex |
9594
result = this.getImplicitDestructorCall(destructorIndex) and
96-
id = maxChildId + 1 + destructorIndex
95+
id = this.getFirstDestructorCallIndex() + destructorIndex
9796
)
9897
}
9998

0 commit comments

Comments
 (0)