Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++: Generate IR for destruction of unconditionally constructed temporaries #16125

Merged
merged 39 commits into from
Apr 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
75c453f
C++: Unsuppress temporary destructors in IR
rdmarsh2 Mar 5, 2024
894d934
C++: Accept test changes.
MathiasVP Apr 4, 2024
17e8c95
C++: suppress destructors on conditional temporaries
rdmarsh2 Mar 12, 2024
cf996f8
C++: Accept test changes.
MathiasVP Apr 4, 2024
d4e2d37
C++: Add a simple test that fails.
MathiasVP Apr 4, 2024
a756f14
C++: Only report implicit destructors if we need to translate them.
MathiasVP Apr 4, 2024
56a132f
C++: Accept test changes.
MathiasVP Apr 4, 2024
796fcfe
C++: Handle conversions in 'isInConditionalEvaluation'.
MathiasVP Apr 4, 2024
a6a0e20
C++: Accept test changes.
MathiasVP Apr 4, 2024
73602dc
C++: Also suppress destructor calls on throwing ternary expressions.
MathiasVP Apr 4, 2024
0b7070f
C++: Accept test changes.
MathiasVP Apr 4, 2024
774efb5
Merge branch 'main' into destructors-for-unconditional-unnamed
MathiasVP Apr 4, 2024
805b4d6
C++: Add a failing testcase.
MathiasVP Apr 4, 2024
1808886
C++: Properly handle the case where a TranslatedElement has no children.
MathiasVP Apr 4, 2024
8f11cb6
C++: Accept test changes.
MathiasVP Apr 4, 2024
587ae07
C++: Accept query test changes.
MathiasVP Apr 4, 2024
f098b8e
C++: Make sure the edge kind out of a throw is an 'ExceptionEdge' eve…
MathiasVP Apr 4, 2024
b6ddb97
C++: Accept test changes.
MathiasVP Apr 4, 2024
e63a607
C++: Add another test with conditional construction.
MathiasVP Apr 5, 2024
d279e3f
C++: Suppress destructor calls for the right-hand side of logical ope…
MathiasVP Apr 5, 2024
bb2c690
C++: Accept test changes.
MathiasVP Apr 5, 2024
b042366
C++: Add a failing testcase.
MathiasVP Apr 5, 2024
f1d2dac
C++: Fix a bug where the destructor attached to a 'new' expression would
MathiasVP Apr 5, 2024
4c01c06
C++: Accept test changes.
MathiasVP Apr 5, 2024
955f9c7
C++: Add a failing testcase.
MathiasVP Apr 5, 2024
54e4103
C++: Fix another multiple parents problem.
MathiasVP Apr 5, 2024
45e7154
C++: Accept test changes.
MathiasVP Apr 5, 2024
a0de95d
C++: Add testcases that produces an 'missingOperandType' and 'missing…
MathiasVP Apr 6, 2024
89eaadd
C++: Move destructor calls from expressions with a temporary object c…
MathiasVP Apr 7, 2024
fcd0e99
C++: Accept test changes.
MathiasVP Apr 7, 2024
8a6a60e
C++: Also handle destructor calls on converted expressions in PrintAST.
MathiasVP Apr 7, 2024
d40fa4c
C++: Accept test changes.
MathiasVP Apr 7, 2024
febd060
C++: Add testcase where two destructor calls are remapped to a tempor…
MathiasVP Apr 8, 2024
9c25ce4
C++: Add testcase with two destructor calls without a temporary objec…
MathiasVP Apr 8, 2024
4fa53b6
Merge branch 'main' into destructors-for-unconditional-unnamed
MathiasVP Apr 8, 2024
17c8fa3
Update cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/Tran…
MathiasVP Apr 9, 2024
c325a79
C++: Ensure 'isConditionalTemporaryDestructorCall' only holds when th…
MathiasVP Apr 9, 2024
7172e2f
Merge branch 'main' into destructors-for-unconditional-unnamed
MathiasVP Apr 10, 2024
736d59c
Merge branch 'main' into destructors-for-unconditional-unnamed
MathiasVP Apr 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ class Expr extends StmtParent, @expr {
* order of destruction.
*/
DestructorCall getImplicitDestructorCall(int n) {
exists(Expr e |
e = this.(TemporaryObjectExpr).getExpr() and
synthetic_destructor_call(e, max(int i | synthetic_destructor_call(e, i, _)) - n, result)
)
or
not this = any(TemporaryObjectExpr temp).getExpr() and
jketema marked this conversation as resolved.
Show resolved Hide resolved
synthetic_destructor_call(this, max(int i | synthetic_destructor_call(this, i, _)) - n, result)
}

Expand Down