File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
lib/semmle/code/csharp/dataflow/internal Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,7 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
35
35
override predicate argHasPostUpdateExclude ( ArgumentNode n ) {
36
36
n instanceof SummaryNode
37
37
or
38
- n .asExpr ( ) .( Expr ) .stripCasts ( ) .getType ( ) =
39
- any ( Type t |
40
- not t instanceof RefType and
41
- not t = any ( TypeParameter tp | not tp .isValueType ( ) )
42
- or
43
- t instanceof NullType
44
- )
38
+ not exists ( getAPostUpdateNodeForArg ( n .asExpr ( ) ) )
45
39
or
46
40
n instanceof ImplicitCapturedArgumentNode
47
41
or
@@ -50,5 +44,21 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
50
44
n .asExpr ( ) instanceof CIL:: Expr
51
45
}
52
46
47
+ override predicate postHasUniquePreExclude ( PostUpdateNode n ) {
48
+ exists ( ControlFlow:: Nodes:: ExprNode e , ControlFlow:: Nodes:: ExprNode arg |
49
+ e = getAPostUpdateNodeForArg ( arg .getExpr ( ) ) and
50
+ e != arg and
51
+ n = TExprPostUpdateNode ( e )
52
+ )
53
+ }
54
+
55
+ override predicate uniquePostUpdateExclude ( Node n ) {
56
+ exists ( ControlFlow:: Nodes:: ExprNode e , ControlFlow:: Nodes:: ExprNode arg |
57
+ e = getAPostUpdateNodeForArg ( arg .getExpr ( ) ) and
58
+ e != arg and
59
+ n .asExpr ( ) = arg .getExpr ( )
60
+ )
61
+ }
62
+
53
63
override predicate reverseReadExclude ( Node n ) { n .asExpr ( ) = any ( AwaitExpr ae ) .getExpr ( ) }
54
64
}
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ private predicate relevantArgumentType(ControlFlow::Nodes::ExprNode cfn) {
197
197
}
198
198
199
199
/** Gets a node for which to construct a post-update node for argument `arg`. */
200
- private ControlFlow:: Nodes:: ExprNode getAPostUpdateNodeForArg ( Argument arg ) {
200
+ ControlFlow:: Nodes:: ExprNode getAPostUpdateNodeForArg ( Argument arg ) {
201
201
result = getALastEvalNode * ( arg .getAControlFlowNode ( ) ) and
202
202
relevantArgumentType ( result ) and
203
203
not exists ( getALastEvalNode ( result ) )
You can’t perform that action at this time.
0 commit comments