C++: suppress destructor calls on delete in IR generation

This avoids an issue with duplicated qualifiers that was causing broken control flow
This commit is contained in:
Robert Marsh
2024-02-06 14:55:00 +00:00
parent 8013c2a074
commit 40e06b7877
2 changed files with 105 additions and 176 deletions

View File

@@ -116,6 +116,11 @@ private predicate ignoreExprOnly(Expr expr) {
or
not translateFunction(getEnclosingFunction(expr)) and
not Raw::varHasIRFunc(getEnclosingVariable(expr))
or
exists(DeleteOrDeleteArrayExpr deleteExpr |
// Ignore the destructor call, because the duplicated qualifier breaks control flow.
deleteExpr.getDestructorCall() = expr
)
}
/**
@@ -918,6 +923,7 @@ abstract class TranslatedElement extends TTranslatedElement {
* holds.
*/
abstract Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind);
/**
* Gets the successor instruction of the instruction that was generated by
* this element for tag `tag`. The successor edge kind is specified by `kind`.