Skip to content

Commit 680ea0b

Browse files
authored
Merge pull request #21552 from MathiasVP/more-public-dataflow-apis
C++: Expose indirect instructions and indirect parameters in dataflow
2 parents a576330 + 8cebf51 commit 680ea0b

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
category: feature
33
---
4-
* Added a new data flow node, `IndirectUninitializedNode`, that represents uninitialized local variables behind a number of indirections.
4+
* Added a class `IndirectUninitializedNode` to represent the indirection of an uninitialized local variable as a dataflow node.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
category: feature
3+
---
4+
* Added a class `DataFlow::IndirectParameterNode` to represent the indirection of a parameter as a dataflow node.
5+
* Added a predicate `Node::asIndirectInstruction` which returns the `Instruction` that defines the indirect dataflow node, if any.

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@ module Public {
321321
*/
322322
Operand asIndirectOperand(int index) { hasOperandAndIndex(this, result, index) }
323323

324+
/**
325+
* Gets the instruction that is indirectly tracked by this node behind
326+
* `index` number of indirections.
327+
*/
328+
Instruction asIndirectInstruction(int index) { hasInstructionAndIndex(this, result, index) }
329+
324330
/**
325331
* Holds if this node is at index `i` in basic block `block`.
326332
*
@@ -830,6 +836,12 @@ module Public {
830836
/** An explicit positional parameter, including `this`, but not `...`. */
831837
final class DirectParameterNode = AbstractDirectParameterNode;
832838

839+
/**
840+
* A node representing an indirection of a positional parameter,
841+
* including `*this`, but not `*...`.
842+
*/
843+
final class IndirectParameterNode = AbstractIndirectParameterNode;
844+
833845
final class ExplicitParameterNode = AbstractExplicitParameterNode;
834846

835847
/** An implicit `this` parameter. */
@@ -989,11 +1001,6 @@ module Public {
9891001

9901002
private import Public
9911003

992-
/**
993-
* A node representing an indirection of a parameter.
994-
*/
995-
final class IndirectParameterNode = AbstractIndirectParameterNode;
996-
9971004
/**
9981005
* A class that lifts pre-SSA dataflow nodes to regular dataflow nodes.
9991006
*/

0 commit comments

Comments
 (0)