mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #7122 from hvitved/csharp/expose-repr-perf
C#: Replace `localFlow` with `localFlowStep` in recursive predicate
This commit is contained in:
@@ -29,17 +29,22 @@ predicate returnsCollection(Callable c, Field f) {
|
||||
not c.(Modifiable).isStatic()
|
||||
}
|
||||
|
||||
predicate mayWriteToCollection(Expr modified) {
|
||||
modified instanceof CollectionModificationAccess
|
||||
predicate nodeMayWriteToCollection(Node modified) {
|
||||
modified.asExpr() instanceof CollectionModificationAccess
|
||||
or
|
||||
exists(Expr mid | mayWriteToCollection(mid) | localExprFlow(modified, mid))
|
||||
exists(Node mid | nodeMayWriteToCollection(mid) | localFlowStep(modified, mid))
|
||||
or
|
||||
exists(MethodCall mid, Callable c | mayWriteToCollection(mid) |
|
||||
mid.getTarget() = c and
|
||||
c.canReturn(modified)
|
||||
exists(Node mid, MethodCall mc, Callable c | nodeMayWriteToCollection(mid) |
|
||||
mc = mid.asExpr() and
|
||||
mc.getTarget() = c and
|
||||
c.canReturn(modified.asExpr())
|
||||
)
|
||||
}
|
||||
|
||||
predicate mayWriteToCollection(Expr modified) {
|
||||
nodeMayWriteToCollection(any(ExprNode n | n.getExpr() = modified))
|
||||
}
|
||||
|
||||
predicate modificationAfter(Expr before, Expr after) {
|
||||
mayWriteToCollection(after) and
|
||||
localFlowStep+(exprNode(before), exprNode(after))
|
||||
|
||||
Reference in New Issue
Block a user