File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
csharp/ql/src/Language Abuse Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 14
14
import csharp
15
15
import semmle.code.csharp.commons.StructuralComparison
16
16
17
+ pragma [ noinline]
18
+ private predicate same ( AssignableAccess x , AssignableAccess y ) {
19
+ exists ( NullCoalescingExpr nce |
20
+ x = nce .getLeftOperand ( ) and
21
+ y = nce .getRightOperand ( ) .getAChildExpr * ( )
22
+ ) and
23
+ sameGvn ( x , y )
24
+ }
25
+
17
26
private predicate uselessNullCoalescingExpr ( NullCoalescingExpr nce ) {
18
- forex ( AssignableAccess y |
19
- y = nce .getRightOperand ( ) .getAChildExpr * ( ) and sameGvn ( nce .getLeftOperand ( ) , y )
20
- |
21
- y instanceof AssignableRead and not y .isRefArgument ( )
27
+ exists ( AssignableAccess x |
28
+ nce .getLeftOperand ( ) = x and
29
+ forex ( AssignableAccess y | same ( x , y ) | y instanceof AssignableRead and not y .isRefArgument ( ) )
22
30
)
23
31
}
24
32
You can’t perform that action at this time.
0 commit comments