Skip to content

Commit 40e06b7

Browse files
committed
C++: suppress destructor calls on delete in IR generation
This avoids an issue with duplicated qualifiers that was causing broken control flow
1 parent 8013c2a commit 40e06b7

File tree

2 files changed

+105
-176
lines changed

2 files changed

+105
-176
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ private predicate ignoreExprOnly(Expr expr) {
116116
or
117117
not translateFunction(getEnclosingFunction(expr)) and
118118
not Raw::varHasIRFunc(getEnclosingVariable(expr))
119+
or
120+
exists(DeleteOrDeleteArrayExpr deleteExpr |
121+
// Ignore the destructor call, because the duplicated qualifier breaks control flow.
122+
deleteExpr.getDestructorCall() = expr
123+
)
119124
}
120125

121126
/**
@@ -918,6 +923,7 @@ abstract class TranslatedElement extends TTranslatedElement {
918923
* holds.
919924
*/
920925
abstract Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind);
926+
921927
/**
922928
* Gets the successor instruction of the instruction that was generated by
923929
* this element for tag `tag`. The successor edge kind is specified by `kind`.

0 commit comments

Comments
 (0)