Skip to content

Commit fbeb6f3

Browse files
committed
Shared: Move shared logic into FlowSummaryImpl.qll
1 parent 395901b commit fbeb6f3

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,9 @@ module LocalFlow {
731731
or
732732
node2 = node1.(LocalFunctionCreationNode).getAnAccess(true)
733733
or
734-
node1 =
735-
unique(FlowSummaryNode n1 |
736-
FlowSummaryImpl::Private::Steps::summaryLocalStep(n1.getSummaryNode(),
737-
node2.(FlowSummaryNode).getSummaryNode(), true, _)
738-
)
734+
FlowSummaryImpl::Private::Steps::summaryLocalMustFlowStep(node1
735+
.(FlowSummaryNode)
736+
.getSummaryNode(), node2.(FlowSummaryNode).getSummaryNode())
739737
}
740738
}
741739

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowUtil.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,8 @@ predicate localMustFlowStep(Node node1, Node node2) {
160160
or
161161
node2.asExpr().(AssignExpr).getSource() = node1.asExpr()
162162
or
163-
node1 =
164-
unique(FlowSummaryNode n1 |
165-
FlowSummaryImpl::Private::Steps::summaryLocalStep(n1.getSummaryNode(),
166-
node2.(FlowSummaryNode).getSummaryNode(), true, _)
167-
)
163+
FlowSummaryImpl::Private::Steps::summaryLocalMustFlowStep(node1.(FlowSummaryNode).getSummaryNode(),
164+
node2.(FlowSummaryNode).getSummaryNode())
168165
}
169166

170167
import Cached

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,9 @@ module LocalFlow {
175175
or
176176
node1 = node2.(ImplicitBlockArgumentNode).getParameterNode(true)
177177
or
178-
node1 =
179-
unique(FlowSummaryNode n1 |
180-
FlowSummaryImpl::Private::Steps::summaryLocalStep(n1.getSummaryNode(),
181-
node2.(FlowSummaryNode).getSummaryNode(), true, _)
182-
)
178+
FlowSummaryImpl::Private::Steps::summaryLocalMustFlowStep(node1
179+
.(FlowSummaryNode)
180+
.getSummaryNode(), node2.(FlowSummaryNode).getSummaryNode())
183181
}
184182
}
185183

rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,11 +1030,9 @@ module RustDataFlow implements InputSig<Location> {
10301030
predicate localMustFlowStep(Node node1, Node node2) {
10311031
SsaFlow::localMustFlowStep(_, node1, node2)
10321032
or
1033-
node1 =
1034-
unique(Node::FlowSummaryNode n1 |
1035-
FlowSummaryImpl::Private::Steps::summaryLocalStep(n1.getSummaryNode(),
1036-
node2.(Node::FlowSummaryNode).getSummaryNode(), true, _)
1037-
)
1033+
FlowSummaryImpl::Private::Steps::summaryLocalMustFlowStep(node1
1034+
.(Node::FlowSummaryNode)
1035+
.getSummaryNode(), node2.(Node::FlowSummaryNode).getSummaryNode())
10381036
}
10391037

10401038
class LambdaCallKind = Void;

shared/dataflow/codeql/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,11 @@ module Make<
12071207
)
12081208
}
12091209

1210+
/** Holds if the value of `succ` is uniquely determined by the value of `pred`. */
1211+
predicate summaryLocalMustFlowStep(SummaryNode pred, SummaryNode succ) {
1212+
pred = unique(SummaryNode n1 | summaryLocalStep(n1, succ, true, _))
1213+
}
1214+
12101215
/**
12111216
* Holds if there is a read step of content `c` from `pred` to `succ`, which
12121217
* is synthesized from a flow summary.

0 commit comments

Comments
 (0)