@@ -23,6 +23,7 @@ private import internal.CallableReturns
23
23
private import semmle.code.csharp.commons.Assertions
24
24
private import semmle.code.csharp.controlflow.Guards as G
25
25
private import semmle.code.csharp.controlflow.Guards:: AbstractValues
26
+ private import semmle.code.csharp.dataflow.internal.SsaImpl as SsaImpl
26
27
private import semmle.code.csharp.frameworks.System
27
28
private import semmle.code.csharp.frameworks.Test
28
29
@@ -177,7 +178,7 @@ private predicate defMaybeNull(Ssa::Definition def, string msg, Element reason)
177
178
exists ( G:: DereferenceableExpr de | de = def .getARead ( ) |
178
179
reason = de .getANullCheck ( _, true ) and
179
180
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
181
182
strictcount ( Element e | e = any ( Ssa:: Definition def0 | de = def0 .getARead ( ) ) .getElement ( ) ) = 1 and
182
183
// Don't use a check as reason if there is a `null` assignment
183
184
// or argument
@@ -205,7 +206,7 @@ private predicate defMaybeNull(Ssa::Definition def, string msg, Element reason)
205
206
// A variable of nullable type may be null
206
207
exists ( Dereference d | dereferenceAt ( _, _, def , d ) |
207
208
d .hasNullableType ( ) and
208
- not def instanceof Ssa:: PseudoDefinition and
209
+ not def instanceof Ssa:: PhiNode and
209
210
reason = def .getSourceVariable ( ) .getAssignable ( ) and
210
211
msg = "because it has a nullable type"
211
212
)
@@ -236,13 +237,13 @@ private predicate defNullImpliesStep(
236
237
Ssa:: Definition def1 , BasicBlock bb1 , Ssa:: Definition def2 , BasicBlock bb2
237
238
) {
238
239
exists ( Ssa:: SourceVariable v | defNullImpliesStep0 ( v , def1 , bb1 , bb2 ) |
239
- def2 .( Ssa:: PseudoDefinition ) .getAnInput ( ) = def1 and
240
+ def2 .( Ssa:: PhiNode ) .getAnInput ( ) = def1 and
240
241
bb2 = def2 .getBasicBlock ( )
241
242
or
242
243
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 ( )
246
247
)
247
248
) and
248
249
not exists ( SuccessorTypes:: ConditionalSuccessor s , NullValue nv |
@@ -426,14 +427,14 @@ module PathGraph {
426
427
}
427
428
428
429
private Ssa:: Definition getAPseudoInput ( Ssa:: Definition def ) {
429
- result = def .( Ssa:: PseudoDefinition ) .getAnInput ( )
430
+ result = def .( Ssa:: PhiNode ) .getAnInput ( )
430
431
}
431
432
432
433
// `def.getAnUltimateDefinition()` includes inputs into uncertain
433
434
// definitions, but we only want inputs into pseudo nodes
434
435
private Ssa:: Definition getAnUltimateDefinition ( Ssa:: Definition def ) {
435
436
result = getAPseudoInput * ( def ) and
436
- not result instanceof Ssa:: PseudoDefinition
437
+ not result instanceof Ssa:: PhiNode
437
438
}
438
439
439
440
/**
@@ -446,7 +447,7 @@ private predicate defReaches(Ssa::Definition def, ControlFlow::Node cfn, boolean
446
447
( always = true or always = false )
447
448
or
448
449
exists ( ControlFlow:: Node mid | defReaches ( def , mid , always ) |
449
- Ssa :: Internal :: adjacentReadPairSameVar ( _, mid , cfn ) and
450
+ SsaImpl :: adjacentReadPairSameVar ( _, mid , cfn ) and
450
451
not mid =
451
452
any ( Dereference d |
452
453
if always = true
0 commit comments