1
1
private import DataFlowImplSpecific:: Private
2
2
import DataFlowImplSpecific:: Public
3
3
4
+ private ReturnNode getAReturnNodeOfKind ( ReturnKind kind ) { result .getKind ( ) = kind }
5
+
4
6
cached
5
7
private module ImplCommon {
6
8
/**
@@ -83,7 +85,7 @@ private module ImplCommon {
83
85
DataFlowCall call , int i , ArgumentNode arg , DataFlowCallable enclosing
84
86
) {
85
87
arg .argumentOf ( call , i ) and
86
- argumentValueFlowsThroughNoCtx0 ( call , arg , _) and
88
+ argumentValueFlowsThroughNoCtx ( arg , _) and
87
89
enclosing = arg .getEnclosingCallable ( )
88
90
}
89
91
@@ -94,7 +96,9 @@ private module ImplCommon {
94
96
or
95
97
exists ( ParameterNode p | outercc = TSomeCall ( p , _) | c = p .getEnclosingCallable ( ) )
96
98
or
97
- exists ( DataFlowCall other | outercc = TSpecificCall ( other , _, _) | c = viableCallable ( other ) )
99
+ exists ( DataFlowCall other | outercc = TSpecificCall ( other , _, _) |
100
+ reducedViableImplInCallContext ( _, c , other )
101
+ )
98
102
)
99
103
}
100
104
@@ -124,12 +128,13 @@ private module ImplCommon {
124
128
)
125
129
}
126
130
127
- cached
128
- CallContextCall getAValidCallContextForParameter ( ParameterNode p ) {
131
+ private CallContextCall getAValidCallContextForParameter ( ParameterNode p ) {
129
132
result = TSomeCall ( p , _)
130
133
or
131
- exists ( DataFlowCall call , int i | result = TSpecificCall ( call , i , _) |
132
- p .isParameterOf ( _, i ) and p .getEnclosingCallable ( ) = viableCallable ( call )
134
+ exists ( DataFlowCall call , int i , DataFlowCallable callable |
135
+ result = TSpecificCall ( call , i , _) and
136
+ p .isParameterOf ( callable , i ) and
137
+ reducedViableImplInCallContext ( _, callable , call )
133
138
)
134
139
}
135
140
@@ -156,8 +161,6 @@ private module ImplCommon {
156
161
)
157
162
}
158
163
159
- private ReturnNode getAReturnNodeOfKind ( ReturnKind kind ) { result .getKind ( ) = kind }
160
-
161
164
/**
162
165
* Holds if `p` can flow to a return node of kind `kind` in the same
163
166
* callable using only value-preserving steps, in call context `cc`.
@@ -172,8 +175,7 @@ private module ImplCommon {
172
175
DataFlowCall call , ArgumentNode arg , ReturnKind kind , CallContext cc
173
176
) {
174
177
exists ( ParameterNode param , CallContext innercc |
175
- viableParamArg ( call , param , arg , cc , innercc )
176
- |
178
+ viableParamArg ( call , param , arg , cc , innercc ) and
177
179
parameterValueFlowsThrough ( param , kind , innercc )
178
180
)
179
181
}
@@ -271,7 +273,8 @@ private module ImplCommon {
271
273
}
272
274
273
275
private predicate storeReturn ( Node node1 , Content f , Node node2 ) {
274
- exists ( DataFlowCall call , ReturnKind kind | storeReturn0 ( call , kind , node1 , f ) |
276
+ exists ( DataFlowCall call , ReturnKind kind |
277
+ storeReturn0 ( call , kind , node1 , f ) and
275
278
node2 = getAnOutNode ( call , kind ) and
276
279
compatibleTypes ( node1 .getTypeBound ( ) , f .getType ( ) ) and
277
280
compatibleTypes ( node2 .getTypeBound ( ) , f .getContainerType ( ) )
@@ -302,7 +305,8 @@ private module ImplCommon {
302
305
predicate read ( Node node1 , Content f , Node node2 ) {
303
306
readStep ( node1 , f , node2 ) and storeStep ( _, f , _)
304
307
or
305
- exists ( DataFlowCall call , ReturnKind kind | read0 ( call , kind , node1 , f ) |
308
+ exists ( DataFlowCall call , ReturnKind kind |
309
+ read0 ( call , kind , node1 , f ) and
306
310
node2 = getAnOutNode ( call , kind ) and
307
311
compatibleTypes ( node1 .getTypeBound ( ) , f .getContainerType ( ) ) and
308
312
compatibleTypes ( node2 .getTypeBound ( ) , f .getType ( ) )
0 commit comments