Skip to content

Commit 6e9ebca

Browse files
committed
C#: Switch from ssaDefAssigns/ssaDefInitializesParam to ssaDefHasSource.
1 parent d8e14a6 commit 6e9ebca

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ module SsaFlow {
506506
result.(Impl::ExprPostUpdateNode).getExpr() =
507507
n.(PostUpdateNode).getPreUpdateNode().(ExprNode).getControlFlowNode()
508508
or
509-
result.(Impl::ParameterNode).getParameter() = n.(ExplicitParameterNode).getSsaDefinition()
509+
result.(Impl::WriteDefSourceNode).getDefinition() = n.(ExplicitParameterNode).getSsaDefinition()
510510
}
511511

512512
predicate localFlowStep(Ssa::SourceVariable v, Node nodeFrom, Node nodeTo, boolean isUseStep) {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,12 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
10231023

10241024
Expr getARead(Definition def) { exists(getAReadAtNode(def, result)) }
10251025

1026+
predicate ssaDefHasSource(WriteDefinition def) {
1027+
// exclude flow directly from RHS to SSA definition, as we instead want to
1028+
// go from RHS to matching assignable definition, and from there to SSA definition
1029+
def instanceof Ssa::ImplicitParameterDefinition
1030+
}
1031+
10261032
predicate ssaDefAssigns(WriteDefinition def, Expr value) {
10271033
// exclude flow directly from RHS to SSA definition, as we instead want to
10281034
// go from RHS to matching assingnable definition, and from there to SSA definition
@@ -1031,7 +1037,7 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
10311037

10321038
class Parameter = Ssa::ImplicitParameterDefinition;
10331039

1034-
predicate ssaDefInitializesParam(WriteDefinition def, Parameter p) { def = p }
1040+
predicate ssaDefInitializesParam(WriteDefinition def, Parameter p) { none() }
10351041

10361042
/**
10371043
* Allows for flow into uncertain defintions that are not call definitions,

0 commit comments

Comments
 (0)