@@ -64,6 +64,14 @@ module LocalFlow {
64
64
)
65
65
}
66
66
67
+ /**
68
+ * Holds if there is a local use-use flow step from `nodeFrom` to `nodeTo`
69
+ * involving SSA definition `def`.
70
+ */
71
+ predicate localSsaFlowStepUseUse ( Ssa:: Definition def , Node nodeFrom , Node nodeTo ) {
72
+ def .hasAdjacentReads ( nodeFrom .asExpr ( ) , nodeTo .asExpr ( ) )
73
+ }
74
+
67
75
/**
68
76
* Holds if there is a local flow step from `nodeFrom` to `nodeTo` involving
69
77
* SSA definition `def`.
@@ -78,17 +86,7 @@ module LocalFlow {
78
86
nodeTo .asExpr ( ) = def .getAFirstRead ( )
79
87
or
80
88
// Flow from read to next read
81
- exists (
82
- CfgNodes:: ExprNodes:: VariableReadAccessCfgNode read1 ,
83
- CfgNodes:: ExprNodes:: VariableReadAccessCfgNode read2
84
- |
85
- def .hasAdjacentReads ( read1 , read2 ) and
86
- nodeTo .asExpr ( ) = read2
87
- |
88
- nodeFrom .asExpr ( ) = read1
89
- or
90
- read1 = nodeFrom .( PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( )
91
- )
89
+ localSsaFlowStepUseUse ( def , nodeFrom .( PostUpdateNode ) .getPreUpdateNode ( ) , nodeTo )
92
90
or
93
91
// Flow into phi node
94
92
exists ( Ssa:: PhiNode phi |
@@ -210,6 +208,9 @@ private module Cached {
210
208
or
211
209
nodeTo .( SynthReturnNode ) .getAnInput ( ) = nodeFrom
212
210
or
211
+ LocalFlow:: localSsaFlowStepUseUse ( _, nodeFrom , nodeTo ) and
212
+ not FlowSummaryImpl:: Private:: Steps:: summaryClearsContentArg ( nodeFrom , _)
213
+ or
213
214
FlowSummaryImpl:: Private:: Steps:: summaryLocalStep ( nodeFrom , nodeTo , true )
214
215
}
215
216
@@ -222,6 +223,8 @@ private module Cached {
222
223
or
223
224
nodeTo = LocalFlow:: getParameterDefNode ( nodeFrom .( ParameterNode ) .getParameter ( ) )
224
225
or
226
+ LocalFlow:: localSsaFlowStepUseUse ( _, nodeFrom , nodeTo )
227
+ or
225
228
// Simple flow through library code is included in the exposed local
226
229
// step relation, even though flow is technically inter-procedural
227
230
FlowSummaryImpl:: Private:: Steps:: summaryThroughStep ( nodeFrom , nodeTo , true )
@@ -236,6 +239,8 @@ private module Cached {
236
239
defaultValueFlow ( p , nodeFrom ) and
237
240
nodeTo = LocalFlow:: getParameterDefNode ( p )
238
241
)
242
+ or
243
+ LocalFlow:: localSsaFlowStepUseUse ( _, nodeFrom , nodeTo )
239
244
}
240
245
241
246
cached
0 commit comments