@@ -11,6 +11,7 @@ private newtype TNode =
1111 MkSsaNode ( SsaDefinition ssa ) or
1212 MkGlobalFunctionNode ( Function f ) or
1313 MkImplicitVarargsSlice ( CallExpr c ) { c .hasImplicitVarargs ( ) } or
14+ MkSliceElementNode ( SliceExpr se ) or
1415 MkFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn )
1516
1617/** Nodes intended for only use inside the data-flow libraries. */
@@ -998,6 +999,37 @@ module Public {
998999 Node getMax ( ) { result = DataFlow:: instructionNode ( insn .getMax ( ) ) }
9991000 }
10001001
1002+ /**
1003+ * A data-flow node which exists solely to model the value flow from array
1004+ * elements of the base of a `SliceNode` to array elements of the `SliceNode`
1005+ * itself.
1006+ */
1007+ class SliceElementNode extends Node , MkSliceElementNode {
1008+ IR:: SliceInstruction si ;
1009+
1010+ SliceElementNode ( ) { this = MkSliceElementNode ( si .getExpr ( ) ) }
1011+
1012+ override ControlFlow:: Root getRoot ( ) { result = this .getSliceNode ( ) .getRoot ( ) }
1013+
1014+ override Type getType ( ) {
1015+ result = si .getResultType ( ) .( ArrayType ) .getElementType ( ) or
1016+ result = si .getResultType ( ) .( SliceType ) .getElementType ( )
1017+ }
1018+
1019+ override string getNodeKind ( ) { result = "slice element node" }
1020+
1021+ override string toString ( ) { result = "slice element node" }
1022+
1023+ override predicate hasLocationInfo (
1024+ string filepath , int startline , int startcolumn , int endline , int endcolumn
1025+ ) {
1026+ si .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1027+ }
1028+
1029+ /** Gets the `SliceNode` which this node relates to. */
1030+ SliceNode getSliceNode ( ) { result = DataFlow:: instructionNode ( si ) }
1031+ }
1032+
10011033 /**
10021034 * A data-flow node corresponding to an expression with a binary operator.
10031035 */
0 commit comments