File tree Expand file tree Collapse file tree
lib/semmle/code/csharp/dataflow/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,13 +35,7 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
3535 override predicate argHasPostUpdateExclude ( ArgumentNode n ) {
3636 n instanceof SummaryNode
3737 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 ( ) ) )
4539 or
4640 n instanceof ImplicitCapturedArgumentNode
4741 or
@@ -50,5 +44,21 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
5044 n .asExpr ( ) instanceof CIL:: Expr
5145 }
5246
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+
5363 override predicate reverseReadExclude ( Node n ) { n .asExpr ( ) = any ( AwaitExpr ae ) .getExpr ( ) }
5464}
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ private predicate relevantArgumentType(ControlFlow::Nodes::ExprNode cfn) {
197197}
198198
199199/** 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 ) {
201201 result = getALastEvalNode * ( arg .getAControlFlowNode ( ) ) and
202202 relevantArgumentType ( result ) and
203203 not exists ( getALastEvalNode ( result ) )
You can’t perform that action at this time.
0 commit comments