Skip to content

Commit 4fe7594

Browse files
committed
C#: Remove the post update node restriction for argument and reverse step.
1 parent f0e665d commit 4fe7594

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,20 +1077,6 @@ private class FieldOrPropertyUsedInSource extends FieldOrProperty {
10771077
}
10781078
}
10791079

1080-
/**
1081-
* Hold if `e` has a type that allows for it to have a post-update node.
1082-
*/
1083-
predicate exprMayHavePostUpdateNode(Expr e) {
1084-
exists(Type t | t = e.stripCasts().getType() |
1085-
t instanceof RefType and
1086-
not t instanceof NullType
1087-
or
1088-
t = any(TypeParameter tp | not tp.isValueType())
1089-
or
1090-
t.isRefLikeType()
1091-
)
1092-
}
1093-
10941080
/** A collection of cached types and predicates to be evaluated in the same stage. */
10951081
cached
10961082
private module Cached {
@@ -1137,15 +1123,12 @@ private module Cached {
11371123
cfn.getAstNode().(ObjectCreation).hasInitializer()
11381124
} or
11391125
TExprPostUpdateNode(ControlFlow::Nodes::ExprNode cfn) {
1140-
(
1141-
cfn.getExpr() instanceof Argument
1142-
or
1143-
cfn =
1144-
LocalFlow::getPostUpdateReverseStep(any(ControlFlow::Nodes::ExprNode e |
1145-
exists(any(SourcePostUpdateNode p).getPreUpdateNode().asExprAtNode(e))
1146-
))
1147-
) and
1148-
exprMayHavePostUpdateNode(cfn.getExpr())
1126+
cfn.getExpr() instanceof Argument
1127+
or
1128+
cfn =
1129+
LocalFlow::getPostUpdateReverseStep(any(ControlFlow::Nodes::ExprNode e |
1130+
exists(any(SourcePostUpdateNode p).getPreUpdateNode().asExprAtNode(e))
1131+
))
11491132
or
11501133
exists(Expr e | e = cfn.getExpr() |
11511134
fieldOrPropertyStore(_, _, _, e, true)

0 commit comments

Comments
 (0)