@@ -5,6 +5,7 @@ private import DataFlowPublic
55private import semmle.code.powershell.typetracking.internal.TypeTrackingImpl
66private import FlowSummaryImpl as FlowSummaryImpl
77private import semmle.code.powershell.dataflow.FlowSummary
8+ private import SsaImpl as SsaImpl
89private import codeql.util.Boolean
910private import codeql.util.Unit
1011
@@ -39,10 +40,10 @@ abstract class LibraryCallable extends string {
3940 LibraryCallable ( ) { any ( ) }
4041
4142 /** Gets a call to this library callable. */
42- Call getACall ( ) { none ( ) }
43+ CallExpr getACall ( ) { none ( ) }
4344
4445 /** Same as `getACall()` except this does not depend on the call graph or API graph. */
45- Call getACallSimple ( ) { none ( ) }
46+ CallExpr getACallSimple ( ) { none ( ) }
4647}
4748
4849/** A callable defined in library code, which should be taken into account in type tracking. */
@@ -90,7 +91,7 @@ abstract class DataFlowCall extends TDataFlowCall {
9091 abstract DataFlowCallable getEnclosingCallable ( ) ;
9192
9293 /** Gets the underlying source code call, if any. */
93- abstract CfgNodes:: CallCfgNode asCall ( ) ;
94+ abstract CfgNodes:: ExprNodes :: CallExprCfgNode asCall ( ) ;
9495
9596 /** Gets a textual representation of this call. */
9697 abstract string toString ( ) ;
@@ -130,19 +131,19 @@ class SummaryCall extends DataFlowCall, TSummaryCall {
130131
131132 override DataFlowCallable getEnclosingCallable ( ) { result .asLibraryCallable ( ) = c }
132133
133- override CfgNodes:: CallCfgNode asCall ( ) { none ( ) }
134+ override CfgNodes:: ExprNodes :: CallExprCfgNode asCall ( ) { none ( ) }
134135
135136 override string toString ( ) { result = "[summary] call to " + receiver + " in " + c }
136137
137138 override EmptyLocation getLocation ( ) { any ( ) }
138139}
139140
140141class NormalCall extends DataFlowCall , TNormalCall {
141- private CfgNodes:: CallCfgNode c ;
142+ private CfgNodes:: ExprNodes :: CallExprCfgNode c ;
142143
143144 NormalCall ( ) { this = TNormalCall ( c ) }
144145
145- override CfgNodes:: CallCfgNode asCall ( ) { result = c }
146+ override CfgNodes:: ExprNodes :: CallExprCfgNode asCall ( ) { result = c }
146147
147148 override DataFlowCallable getEnclosingCallable ( ) { result = TCfgScope ( c .getScope ( ) ) }
148149
@@ -161,7 +162,7 @@ private module TrackInstanceInput implements CallGraphConstruction::InputSig {
161162 start .( ObjectCreationNode ) .getObjectCreationNode ( ) .getConstructedTypeName ( ) = typename and
162163 exact = true
163164 or
164- start .asExpr ( ) .( CfgNodes:: ExprNodes:: TypeNameCfgNode ) . getTypeName ( ) = typename and
165+ start .asExpr ( ) .( CfgNodes:: ExprNodes:: TypeNameExprCfgNode ) . getName ( ) = typename and
165166 exact = true
166167 or
167168 start .asParameter ( ) .getStaticType ( ) = typename and
@@ -195,7 +196,9 @@ private module TrackInstanceInput implements CallGraphConstruction::InputSig {
195196 predicate filter ( Node n , Unit u ) { none ( ) }
196197}
197198
198- private predicate qualifiedCall ( CfgNodes:: CallCfgNode call , Node receiver , string method ) {
199+ private predicate qualifiedCall (
200+ CfgNodes:: ExprNodes:: CallExprCfgNode call , Node receiver , string method
201+ ) {
199202 call .getQualifier ( ) = receiver .asExpr ( ) and
200203 call .getName ( ) = method
201204}
@@ -214,7 +217,7 @@ private Type getTypeWithName(string s, boolean exact) {
214217 exact = false
215218}
216219
217- private CfgScope getTargetInstance ( CfgNodes:: CallCfgNode call ) {
220+ private CfgScope getTargetInstance ( CfgNodes:: ExprNodes :: CallExprCfgNode call ) {
218221 // TODO: Also match argument/parameter types
219222 exists ( Node receiver , string method , string typename , Type t , boolean exact |
220223 qualifiedCall ( call , receiver , method ) and
@@ -236,7 +239,7 @@ class AdditionalCallTarget extends Unit {
236239 /**
237240 * Gets a viable target for `call`.
238241 */
239- abstract DataFlowCallable viableTarget ( CfgNodes:: CallCfgNode call ) ;
242+ abstract DataFlowCallable viableTarget ( CfgNodes:: ExprNodes :: CallExprCfgNode call ) ;
240243}
241244
242245/** Holds if `call` may resolve to the returned summarized library method. */
@@ -256,7 +259,7 @@ private module Cached {
256259
257260 cached
258261 newtype TDataFlowCall =
259- TNormalCall ( CfgNodes:: CallCfgNode c ) or
262+ TNormalCall ( CfgNodes:: ExprNodes :: CallExprCfgNode c ) or
260263 TSummaryCall (
261264 FlowSummaryImpl:: Public:: SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNode receiver
262265 ) {
@@ -283,7 +286,7 @@ private module Cached {
283286 FlowSummaryImpl:: ParsePositions:: isParsedKeywordParameterPosition ( _, name )
284287 } or
285288 TPositionalArgumentPosition ( int pos , NamedSet ns ) {
286- exists ( CfgNodes:: CallCfgNode call |
289+ exists ( CfgNodes:: ExprNodes :: CallExprCfgNode call |
287290 call = ns .getABindingCall ( ) and
288291 exists ( call .getArgument ( pos ) )
289292 )
@@ -297,7 +300,7 @@ private module Cached {
297300 TThisParameterPosition ( ) or
298301 TKeywordParameter ( string name ) { name = any ( Argument p ) .getName ( ) } or
299302 TPositionalParameter ( int pos , NamedSet ns ) {
300- exists ( CfgNodes:: CallCfgNode call |
303+ exists ( CfgNodes:: ExprNodes :: CallExprCfgNode call |
301304 call = ns .getABindingCall ( ) and
302305 exists ( call .getArgument ( pos ) )
303306 )
@@ -306,7 +309,7 @@ private module Cached {
306309 // `ns.getABindingCall()`, but those parameters should still have
307310 // positions since SSA depends on this.
308311 // In particular, global scope is also an uncalled function.
309- any ( Parameter p ) .getIndexExcludingPipelines ( ) = pos and
312+ any ( SsaImpl :: NormalParameter p ) .getIndexExcludingPipelines ( ) = pos and
310313 ns .isEmpty ( )
311314 } or
312315 TPipelineParameter ( )
0 commit comments