@@ -11,6 +11,7 @@ private newtype TNode =
11
11
MkSsaNode ( SsaDefinition ssa ) or
12
12
MkGlobalFunctionNode ( Function f ) or
13
13
MkImplicitVarargsSlice ( CallExpr c ) { c .hasImplicitVarargs ( ) } or
14
+ MkSliceElementNode ( SliceExpr se ) or
14
15
MkFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn )
15
16
16
17
/** Nodes intended for only use inside the data-flow libraries. */
@@ -998,6 +999,37 @@ module Public {
998
999
Node getMax ( ) { result = DataFlow:: instructionNode ( insn .getMax ( ) ) }
999
1000
}
1000
1001
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
+
1001
1033
/**
1002
1034
* A data-flow node corresponding to an expression with a binary operator.
1003
1035
*/
0 commit comments