@@ -23,6 +23,7 @@ private import internal.CallableReturns
2323private import semmle.code.csharp.commons.Assertions
2424private import semmle.code.csharp.controlflow.Guards as G
2525private import semmle.code.csharp.controlflow.Guards:: AbstractValues
26+ private import semmle.code.csharp.dataflow.internal.SsaImpl as SsaImpl
2627private import semmle.code.csharp.frameworks.System
2728private import semmle.code.csharp.frameworks.Test
2829
@@ -177,7 +178,7 @@ private predicate defMaybeNull(Ssa::Definition def, string msg, Element reason)
177178 exists ( G:: DereferenceableExpr de | de = def .getARead ( ) |
178179 reason = de .getANullCheck ( _, true ) and
179180 msg = "as suggested by $@ null check" and
180- not de = any ( Ssa:: PseudoDefinition pdef ) .getARead ( ) and
181+ not de = any ( Ssa:: PhiNode phi ) .getARead ( ) and
181182 strictcount ( Element e | e = any ( Ssa:: Definition def0 | de = def0 .getARead ( ) ) .getElement ( ) ) = 1 and
182183 // Don't use a check as reason if there is a `null` assignment
183184 // or argument
@@ -205,7 +206,7 @@ private predicate defMaybeNull(Ssa::Definition def, string msg, Element reason)
205206 // A variable of nullable type may be null
206207 exists ( Dereference d | dereferenceAt ( _, _, def , d ) |
207208 d .hasNullableType ( ) and
208- not def instanceof Ssa:: PseudoDefinition and
209+ not def instanceof Ssa:: PhiNode and
209210 reason = def .getSourceVariable ( ) .getAssignable ( ) and
210211 msg = "because it has a nullable type"
211212 )
@@ -236,13 +237,13 @@ private predicate defNullImpliesStep(
236237 Ssa:: Definition def1 , BasicBlock bb1 , Ssa:: Definition def2 , BasicBlock bb2
237238) {
238239 exists ( Ssa:: SourceVariable v | defNullImpliesStep0 ( v , def1 , bb1 , bb2 ) |
239- def2 .( Ssa:: PseudoDefinition ) .getAnInput ( ) = def1 and
240+ def2 .( Ssa:: PhiNode ) .getAnInput ( ) = def1 and
240241 bb2 = def2 .getBasicBlock ( )
241242 or
242243 def2 = def1 and
243- not exists ( Ssa:: PseudoDefinition def |
244- def .getSourceVariable ( ) = v and
245- bb2 = def .getBasicBlock ( )
244+ not exists ( Ssa:: PhiNode phi |
245+ phi .getSourceVariable ( ) = v and
246+ bb2 = phi .getBasicBlock ( )
246247 )
247248 ) and
248249 not exists ( SuccessorTypes:: ConditionalSuccessor s , NullValue nv |
@@ -426,14 +427,14 @@ module PathGraph {
426427}
427428
428429private Ssa:: Definition getAPseudoInput ( Ssa:: Definition def ) {
429- result = def .( Ssa:: PseudoDefinition ) .getAnInput ( )
430+ result = def .( Ssa:: PhiNode ) .getAnInput ( )
430431}
431432
432433// `def.getAnUltimateDefinition()` includes inputs into uncertain
433434// definitions, but we only want inputs into pseudo nodes
434435private Ssa:: Definition getAnUltimateDefinition ( Ssa:: Definition def ) {
435436 result = getAPseudoInput * ( def ) and
436- not result instanceof Ssa:: PseudoDefinition
437+ not result instanceof Ssa:: PhiNode
437438}
438439
439440/**
@@ -446,7 +447,7 @@ private predicate defReaches(Ssa::Definition def, ControlFlow::Node cfn, boolean
446447 ( always = true or always = false )
447448 or
448449 exists ( ControlFlow:: Node mid | defReaches ( def , mid , always ) |
449- Ssa :: Internal :: adjacentReadPairSameVar ( _, mid , cfn ) and
450+ SsaImpl :: adjacentReadPairSameVar ( _, mid , cfn ) and
450451 not mid =
451452 any ( Dereference d |
452453 if always = true
0 commit comments