File tree Expand file tree Collapse file tree
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,6 +127,11 @@ private predicate ignoreExprAndDescendants(Expr expr) {
127127 exists ( BuiltInVarArgsStart vaStartExpr |
128128 vaStartExpr .getLastNamedParameter ( ) .getFullyConverted ( ) = expr
129129 )
130+ or
131+ // Do not translate implicit destructor calls for unnamed temporary variables that are
132+ // conditionally constructed (until we have a mechanism for calling these only when the
133+ // temporary's constructor was run)
134+ isConditionalTemporaryDestructorCall ( expr )
130135}
131136
132137/**
@@ -252,6 +257,20 @@ private predicate usedAsCondition(Expr expr) {
252257 )
253258}
254259
260+ private predicate isInConditionalEvaluation ( Expr e ) {
261+ exists ( ConditionalExpr cond |
262+ e = cond .getThen ( ) and not cond .isTwoOperand ( )
263+ or
264+ e = cond .getElse ( )
265+ )
266+ or
267+ isInConditionalEvaluation ( getRealParent ( e ) )
268+ }
269+
270+ private predicate isConditionalTemporaryDestructorCall ( DestructorCall dc ) {
271+ isInConditionalEvaluation ( dc .getQualifier ( ) .( ReuseExpr ) .getReusedExpr ( ) )
272+ }
273+
255274/**
256275 * Holds if `conv` is an `InheritanceConversion` that requires a `TranslatedLoad`, despite not being
257276 * marked as having an lvalue-to-rvalue conversion.
You can’t perform that action at this time.
0 commit comments