C#: Switch from ssaDefAssigns/ssaDefInitializesParam to ssaDefHasSource.

This commit is contained in:
Anders Schack-Mulligen
2025-03-27 15:32:11 +01:00
parent d8e14a6b55
commit 6e9ebca977
2 changed files with 8 additions and 2 deletions

View File

@@ -506,7 +506,7 @@ module SsaFlow {
result.(Impl::ExprPostUpdateNode).getExpr() =
n.(PostUpdateNode).getPreUpdateNode().(ExprNode).getControlFlowNode()
or
result.(Impl::ParameterNode).getParameter() = n.(ExplicitParameterNode).getSsaDefinition()
result.(Impl::WriteDefSourceNode).getDefinition() = n.(ExplicitParameterNode).getSsaDefinition()
}
predicate localFlowStep(Ssa::SourceVariable v, Node nodeFrom, Node nodeTo, boolean isUseStep) {

View File

@@ -1023,6 +1023,12 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
Expr getARead(Definition def) { exists(getAReadAtNode(def, result)) }
predicate ssaDefHasSource(WriteDefinition def) {
// exclude flow directly from RHS to SSA definition, as we instead want to
// go from RHS to matching assignable definition, and from there to SSA definition
def instanceof Ssa::ImplicitParameterDefinition
}
predicate ssaDefAssigns(WriteDefinition def, Expr value) {
// exclude flow directly from RHS to SSA definition, as we instead want to
// go from RHS to matching assingnable definition, and from there to SSA definition
@@ -1031,7 +1037,7 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
class Parameter = Ssa::ImplicitParameterDefinition;
predicate ssaDefInitializesParam(WriteDefinition def, Parameter p) { def = p }
predicate ssaDefInitializesParam(WriteDefinition def, Parameter p) { none() }
/**
* Allows for flow into uncertain defintions that are not call definitions,