C++: Properly handle the case where a TranslatedElement has no children.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-04-04 16:02:01 +01:00
parent 805b4d6465
commit 180888616b

View File

@@ -90,10 +90,9 @@ abstract class TranslatedExpr extends TranslatedElement {
final override TranslatedElement getChild(int id) {
result = this.getChildInternal(id)
or
exists(int maxChildId, int destructorIndex |
maxChildId = max(int childId | exists(this.getChildInternal(childId))) and
exists(int destructorIndex |
result = this.getImplicitDestructorCall(destructorIndex) and
id = maxChildId + 1 + destructorIndex
id = this.getFirstDestructorCallIndex() + destructorIndex
)
}