mirror of
https://github.com/github/codeql.git
synced 2026-05-14 11:19:27 +02:00
C#: Move isLiveOutRefParameterDefinition to top-level.
This commit is contained in:
@@ -190,6 +190,8 @@ module Ssa {
|
||||
)
|
||||
}
|
||||
|
||||
predicate isLiveOutRefParameterDefinition = SsaImpl::isLiveOutRefParameterDefinition/2;
|
||||
|
||||
/**
|
||||
* A static single assignment (SSA) definition. Either an explicit variable
|
||||
* definition (`ExplicitDefinition`), an implicit variable definition
|
||||
@@ -408,10 +410,12 @@ module Ssa {
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: Use `isLiveOutRefParameterDefinition(SsaDefinition, Parameter)` instead.
|
||||
*
|
||||
* Holds if this SSA definition assigns to `out`/`ref` parameter `p`, and the
|
||||
* parameter may remain unchanged throughout the rest of the enclosing callable.
|
||||
*/
|
||||
final predicate isLiveOutRefParameterDefinition(Parameter p) {
|
||||
deprecated final predicate isLiveOutRefParameterDefinition(Parameter p) {
|
||||
SsaImpl::isLiveOutRefParameterDefinition(this, p)
|
||||
}
|
||||
|
||||
|
||||
@@ -1244,7 +1244,7 @@ class SsaNode extends NodeImpl, TSsaNode {
|
||||
class SsaDefinitionNode extends SsaNode {
|
||||
override SsaImpl::DataFlowIntegration::SsaDefinitionNode node;
|
||||
|
||||
Ssa::Definition getDefinition() { result = node.getDefinition() }
|
||||
SsaDefinition getDefinition() { result = node.getDefinition() }
|
||||
|
||||
override ControlFlowNode getControlFlowNodeImpl() {
|
||||
result = this.getDefinition().getControlFlowNode()
|
||||
@@ -1613,7 +1613,7 @@ private module ReturnNodes {
|
||||
|
||||
OutRefReturnNode() {
|
||||
exists(Parameter p |
|
||||
this.getDefinition().isLiveOutRefParameterDefinition(p) and
|
||||
Ssa::isLiveOutRefParameterDefinition(this.getDefinition(), p) and
|
||||
kind.getPosition() = p.getPosition()
|
||||
|
|
||||
p.isOut() and kind instanceof OutReturnKind
|
||||
|
||||
@@ -914,6 +914,10 @@ private module Cached {
|
||||
Impl::uncertainWriteDefinitionInput(def, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the SSA definition `def` assigns to `out`/`ref` parameter `p`, and the
|
||||
* parameter may remain unchanged throughout the rest of the enclosing callable.
|
||||
*/
|
||||
cached
|
||||
predicate isLiveOutRefParameterDefinition(SsaDefinition def, Parameter p) {
|
||||
p.isOutOrRef() and
|
||||
|
||||
@@ -5,7 +5,7 @@ private predicate outRefDef(DataFlow::ExprNode ne, int outRef) {
|
||||
exists(Ssa::ExplicitDefinition def, Parameter outRefParameter |
|
||||
outRefParameter.isOutOrRef() and
|
||||
ne.getExpr() = def.getADefinition().getSource() and
|
||||
def.isLiveOutRefParameterDefinition(outRefParameter) and
|
||||
Ssa::isLiveOutRefParameterDefinition(def, outRefParameter) and
|
||||
outRef = outRefParameter.getPosition()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import csharp
|
||||
|
||||
from Ssa::SourceVariable v, Ssa::Definition def
|
||||
from Ssa::SourceVariable v, SsaDefinition def
|
||||
where
|
||||
v = def.getSourceVariable() and
|
||||
def.isLiveOutRefParameterDefinition(_)
|
||||
Ssa::isLiveOutRefParameterDefinition(def, _)
|
||||
select v, def
|
||||
|
||||
Reference in New Issue
Block a user