C++: Unsuppress temporary destructors in IR

This commit is contained in:
Robert Marsh
2024-03-05 22:26:08 +00:00
committed by Mathias Vorreiter Pedersen
parent c03b74545d
commit 75c453fd30
2 changed files with 13 additions and 3 deletions

View File

@@ -127,9 +127,6 @@ private predicate ignoreExprAndDescendants(Expr expr) {
exists(BuiltInVarArgsStart vaStartExpr |
vaStartExpr.getLastNamedParameter().getFullyConverted() = expr
)
or
// suppress destructors of temporary variables until proper support is added for them.
exists(Expr parent | parent.getAnImplicitDestructorCall() = expr)
}
/**

View File

@@ -97,6 +97,19 @@ abstract class TranslatedExpr extends TranslatedElement {
)
}
final override predicate hasAnImplicitDestructorCall() {
exists(expr.getAnImplicitDestructorCall())
}
final override int getFirstDestructorCallIndex() {
not this.handlesDestructorsExplicitly() and
(
result = max(int childId | exists(this.getChildInternal(childId))) + 1
or
not exists(this.getChildInternal(_)) and result = 0
)
}
final override Locatable getAst() { result = expr }
final override Declaration getFunction() { result = getEnclosingDeclaration(expr) }