Skip to content

Commit 4dfaf92

Browse files
committed
C++: Index 'getConvertedResultExpression' by an integer.
1 parent 16d6218 commit 4dfaf92

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,16 +1052,18 @@ private module GetConvertedResultExpression {
10521052
* Note that this predicate may return multiple results in cases where a conversion belond to a
10531053
* different AST element than its operand.
10541054
*/
1055-
Expr getConvertedResultExpression(Instruction instr) {
1055+
Expr getConvertedResultExpression(Instruction instr, int n) {
10561056
// Only fully converted instructions has a result for `asConvertedExpr`
10571057
not conversionFlow(unique( | | getAUse(instr)), _, false, false) and
1058-
result = getConvertedResultExpressionImpl(instr)
1058+
result = getConvertedResultExpressionImpl(instr) and
1059+
n = 0
10591060
or
10601061
// If the conversion also has a result then we return multiple results
10611062
exists(Operand operand | conversionFlow(operand, instr, false, false) |
1063+
n = 1 and
10621064
result = getConvertedResultExpressionImpl(operand.getDef())
10631065
or
1064-
result = getConvertedResultExpression(operand.getDef())
1066+
result = getConvertedResultExpression(operand.getDef(), n - 1)
10651067
)
10661068
}
10671069

0 commit comments

Comments
 (0)