Skip to content

Commit ec7e6e8

Browse files
committed
C#: Add post-update nodes for arguments of struct type.
1 parent 4e63b83 commit ec7e6e8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ private import ControlFlowReachability
66
private import FlowSummaryImpl as FlowSummaryImpl
77
private import semmle.code.csharp.dataflow.FlowSummary as FlowSummary
88
private import semmle.code.csharp.dataflow.internal.ExternalFlow
9+
private import semmle.code.csharp.commons.Collections
910
private import semmle.code.csharp.Conversion
1011
private import semmle.code.csharp.dataflow.internal.SsaImpl as SsaImpl
1112
private import semmle.code.csharp.ExprOrStmtParent
@@ -16,7 +17,6 @@ private import semmle.code.csharp.frameworks.EntityFramework
1617
private import semmle.code.csharp.frameworks.system.linq.Expressions
1718
private import semmle.code.csharp.frameworks.NHibernate
1819
private import semmle.code.csharp.frameworks.Razor
19-
private import semmle.code.csharp.frameworks.system.Collections
2020
private import semmle.code.csharp.frameworks.system.threading.Tasks
2121
private import semmle.code.csharp.internal.Location
2222
private import codeql.util.Unit
@@ -1087,7 +1087,7 @@ predicate exprMayHavePostUpdateNode(Expr e) {
10871087
or
10881088
t = any(TypeParameter tp | not tp.isValueType())
10891089
or
1090-
t.isRefLikeType()
1090+
t instanceof Struct
10911091
)
10921092
}
10931093

@@ -2545,6 +2545,7 @@ private predicate clearsCont(Node n, Content c) {
25452545
a.getType() = s and
25462546
f = s.getAField() and
25472547
c.(FieldContent).getField() = f.getUnboundDeclaration() and
2548+
not f.getType() instanceof CollectionType and
25482549
not f.isRef()
25492550
)
25502551
or

0 commit comments

Comments
 (0)