mirror of
https://github.com/github/codeql.git
synced 2026-05-14 11:19:27 +02:00
C#: Simplify library instantiations.
This commit is contained in:
@@ -26,17 +26,7 @@ private module ControlFlowInput implements InputSig<Location, ControlFlowNode, B
|
||||
|
||||
class Expr = CS::Expr;
|
||||
|
||||
class SourceVariable = Ssa::SourceVariable;
|
||||
|
||||
class SsaDefinition = Ssa::Definition;
|
||||
|
||||
class SsaExplicitWrite extends SsaDefinition instanceof Ssa::ExplicitDefinition {
|
||||
Expr getValue() { result = super.getADefinition().getSource() }
|
||||
}
|
||||
|
||||
class SsaPhiDefinition = Ssa::PhiNode;
|
||||
|
||||
class SsaUncertainWrite = Ssa::UncertainDefinition;
|
||||
import Ssa
|
||||
|
||||
class GuardValue = Guards::GuardValue;
|
||||
|
||||
|
||||
@@ -191,23 +191,7 @@ private module GuardsImpl = SharedGuards::Make<Location, Cfg, GuardsInput>;
|
||||
class GuardValue = GuardsImpl::GuardValue;
|
||||
|
||||
private module LogicInput implements GuardsImpl::LogicInputSig {
|
||||
class SsaDefinition extends Ssa::Definition {
|
||||
Expr getARead() { super.getARead() = result }
|
||||
}
|
||||
|
||||
class SsaExplicitWrite extends SsaDefinition instanceof Ssa::ExplicitDefinition {
|
||||
Expr getValue() { result = super.getADefinition().getSource() }
|
||||
}
|
||||
|
||||
class SsaPhiDefinition extends SsaDefinition instanceof Ssa::PhiNode {
|
||||
predicate hasInputFromBlock(SsaDefinition inp, BasicBlock bb) {
|
||||
super.hasInputFromBlock(inp, bb)
|
||||
}
|
||||
}
|
||||
|
||||
class SsaParameterInit extends SsaDefinition instanceof Ssa::ParameterDefinition {
|
||||
Parameter getParameter() { result = super.getParameter() }
|
||||
}
|
||||
import Ssa
|
||||
|
||||
predicate additionalNullCheck(GuardsImpl::PreGuard guard, GuardValue val, Expr e, boolean isNull) {
|
||||
// Comparison with a non-`null` value, for example `x?.Length > 0`
|
||||
|
||||
@@ -250,9 +250,9 @@ private predicate defReaches(Ssa::Definition def, ControlFlowNode cfn) {
|
||||
}
|
||||
|
||||
private module NullnessConfig implements ControlFlowReachability::ConfigSig {
|
||||
predicate source(ControlFlowNode node, Ssa::Definition def) { defMaybeNull(def, node, _, _) }
|
||||
predicate source(ControlFlowNode node, SsaDefinition def) { defMaybeNull(def, node, _, _) }
|
||||
|
||||
predicate sink(ControlFlowNode node, Ssa::Definition def) {
|
||||
predicate sink(ControlFlowNode node, SsaDefinition def) {
|
||||
exists(Dereference d |
|
||||
dereferenceAt(node, def, d) and
|
||||
not d instanceof NonNullExpr
|
||||
|
||||
Reference in New Issue
Block a user