Skip to content

Commit 0169e18

Browse files
committed
C++: Add a missing utility predicate on Call instructions.
1 parent 1b41bae commit 0169e18

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,13 @@ class CallInstruction extends Instruction {
17061706
result.getIndex() = index
17071707
}
17081708

1709+
/**
1710+
* Gets a positional argument operand, if any.
1711+
*/
1712+
final PositionalArgumentOperand getAPositionalArgumentOperand() {
1713+
result = this.getPositionalArgumentOperand(_)
1714+
}
1715+
17091716
/**
17101717
* Gets the argument at the specified index.
17111718
*/
@@ -1714,6 +1721,11 @@ class CallInstruction extends Instruction {
17141721
result = this.getPositionalArgumentOperand(index).getDef()
17151722
}
17161723

1724+
/**
1725+
* Gets a positional argument, if any.
1726+
*/
1727+
final Instruction getAPositionalArgument() { result = this.getPositionalArgument(_) }
1728+
17171729
/**
17181730
* Gets the argument operand at the specified index, or `this` if `index` is `-1`.
17191731
*/
@@ -1735,6 +1747,11 @@ class CallInstruction extends Instruction {
17351747
*/
17361748
final int getNumberOfArguments() { result = count(this.getAnArgumentOperand()) }
17371749

1750+
/**
1751+
* Gets the number of positional arguments of the call.
1752+
*/
1753+
final int getNumberOfPositionalArguments() { result = count(this.getAPositionalArgument()) }
1754+
17381755
/**
17391756
* Holds if the result is a side effect for the argument at the specified index, or `this` if
17401757
* `index` is `-1`.

0 commit comments

Comments
 (0)