Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75c453f

Browse files
Robert MarshMathiasVP
authored andcommitted
C++: Unsuppress temporary destructors in IR
1 parent c03b745 commit 75c453f

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ private predicate ignoreExprAndDescendants(Expr expr) {
127127
exists(BuiltInVarArgsStart vaStartExpr |
128128
vaStartExpr.getLastNamedParameter().getFullyConverted() = expr
129129
)
130-
or
131-
// suppress destructors of temporary variables until proper support is added for them.
132-
exists(Expr parent | parent.getAnImplicitDestructorCall() = expr)
133130
}
134131

135132
/**

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@ abstract class TranslatedExpr extends TranslatedElement {
9797
)
9898
}
9999

100+
final override predicate hasAnImplicitDestructorCall() {
101+
exists(expr.getAnImplicitDestructorCall())
102+
}
103+
104+
final override int getFirstDestructorCallIndex() {
105+
not this.handlesDestructorsExplicitly() and
106+
(
107+
result = max(int childId | exists(this.getChildInternal(childId))) + 1
108+
or
109+
not exists(this.getChildInternal(_)) and result = 0
110+
)
111+
}
112+
100113
final override Locatable getAst() { result = expr }
101114

102115
final override Declaration getFunction() { result = getEnclosingDeclaration(expr) }

0 commit comments

Comments
 (0)