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 1414import csharp
1515import semmle.code.csharp.commons.StructuralComparison
1616
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+
1726private 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 ( ) )
2230 )
2331}
2432
You can’t perform that action at this time.
0 commit comments