Skip to content

Commit 89eaadd

Browse files
committed
C++: Move destructor calls from expressions with a temporary object conversion to the temporary object conversion.
1 parent a0de95d commit 89eaadd

File tree

1 file changed

+6
-0
lines changed
  • cpp/ql/lib/semmle/code/cpp/exprs

1 file changed

+6
-0
lines changed

cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ class Expr extends StmtParent, @expr {
6363
* order of destruction.
6464
*/
6565
DestructorCall getImplicitDestructorCall(int n) {
66+
exists(Expr e |
67+
e = this.(TemporaryObjectExpr).getExpr() and
68+
synthetic_destructor_call(e, max(int i | synthetic_destructor_call(e, i, _)) - n, result)
69+
)
70+
or
71+
not this = any(TemporaryObjectExpr temp).getExpr() and
6672
synthetic_destructor_call(this, max(int i | synthetic_destructor_call(this, i, _)) - n, result)
6773
}
6874

0 commit comments

Comments
 (0)