diff --git a/csharp/ql/campaigns/Solorigate/src/ModifiedFnvFunctionDetection.ql b/csharp/ql/campaigns/Solorigate/src/ModifiedFnvFunctionDetection.ql index ed350932bd8..515bbbd91c6 100644 --- a/csharp/ql/campaigns/Solorigate/src/ModifiedFnvFunctionDetection.ql +++ b/csharp/ql/campaigns/Solorigate/src/ModifiedFnvFunctionDetection.ql @@ -19,7 +19,7 @@ from Variable v, Literal l, LoopStmt loop, Expr additional_xor where maybeUsedInFnvFunction(v, _, _, loop) and exists(BitwiseXorOperation xor2 | xor2.getAnOperand() = l and additional_xor = xor2 | - loopExitNode(loop).getASuccessor*() = xor2.getAControlFlowNode() and + loopExitNode(loop).getASuccessor*() = xor2.getControlFlowNode() and xor2.getAnOperand() = v.getAnAccess() ) select l, "This literal is used in an $@ after an FNV-like hash calculation with variable $@.", diff --git a/csharp/ql/lib/experimental/code/csharp/Cryptography/NonCryptographicHashes.qll b/csharp/ql/lib/experimental/code/csharp/Cryptography/NonCryptographicHashes.qll index b09251cf6e4..130e563a663 100644 --- a/csharp/ql/lib/experimental/code/csharp/Cryptography/NonCryptographicHashes.qll +++ b/csharp/ql/lib/experimental/code/csharp/Cryptography/NonCryptographicHashes.qll @@ -30,7 +30,7 @@ predicate maybeUsedInFnvFunction(Variable v, Operation xor, Operation mul, LoopS e2.getAChild*() = v.getAnAccess() and e1 = xor.getAnOperand() and e2 = mul.getAnOperand() and - xor.getAControlFlowNode().getASuccessor*() = mul.getAControlFlowNode() and + xor.getControlFlowNode().getASuccessor*() = mul.getControlFlowNode() and (xor instanceof AssignXorExpr or xor instanceof BitwiseXorExpr) and (mul instanceof AssignMulExpr or mul instanceof MulExpr) ) and @@ -55,11 +55,11 @@ private predicate maybeUsedInElfHashFunction(Variable v, Operation xor, Operatio v = addAssign.getTargetVariable() and addAssign.getAChild*() = add and (xor instanceof BitwiseXorExpr or xor instanceof AssignXorExpr) and - addAssign.getAControlFlowNode().getASuccessor*() = xor.getAControlFlowNode() and + addAssign.getControlFlowNode().getASuccessor*() = xor.getControlFlowNode() and xorAssign.getAChild*() = xor and v = xorAssign.getTargetVariable() and (notOp instanceof UnaryBitwiseOperation or notOp instanceof AssignBitwiseOperation) and - xor.getAControlFlowNode().getASuccessor*() = notOp.getAControlFlowNode() and + xor.getControlFlowNode().getASuccessor*() = notOp.getControlFlowNode() and notAssign.getAChild*() = notOp and v = notAssign.getTargetVariable() and loop.getAChild*() = add.getEnclosingStmt() and diff --git a/csharp/ql/lib/semmle/code/csharp/Assignable.qll b/csharp/ql/lib/semmle/code/csharp/Assignable.qll index 874e657cf08..af6861349d1 100644 --- a/csharp/ql/lib/semmle/code/csharp/Assignable.qll +++ b/csharp/ql/lib/semmle/code/csharp/Assignable.qll @@ -86,7 +86,7 @@ class AssignableRead extends AssignableAccess { pragma[noinline] private ControlFlowNode getAnAdjacentReadSameVar() { - SsaImpl::adjacentReadPairSameVar(_, this.getAControlFlowNode(), result) + SsaImpl::adjacentReadPairSameVar(_, this.getControlFlowNode(), result) } /** @@ -114,11 +114,7 @@ class AssignableRead extends AssignableAccess { * - The read of `this.Field` on line 11 is next to the read on line 10. */ pragma[nomagic] - AssignableRead getANextRead() { - forex(ControlFlowNode cfn | cfn = result.getAControlFlowNode() | - cfn = this.getAnAdjacentReadSameVar() - ) - } + AssignableRead getANextRead() { result.getControlFlowNode() = this.getAnAdjacentReadSameVar() } } /** @@ -410,7 +406,7 @@ private import AssignableInternal */ class AssignableDefinition extends TAssignableDefinition { /** - * DEPRECATED: Use `this.getExpr().getAControlFlowNode()` instead. + * DEPRECATED: Use `this.getExpr().getControlFlowNode()` instead. * * Gets a control flow node that updates the targeted assignable when * reached. @@ -419,7 +415,7 @@ class AssignableDefinition extends TAssignableDefinition { * the definitions of `x` and `y` in `M(out x, out y)` and `(x, y) = (0, 1)` * relate to the same call to `M` and assignment node, respectively. */ - deprecated ControlFlowNode getAControlFlowNode() { result = this.getExpr().getAControlFlowNode() } + deprecated ControlFlowNode getAControlFlowNode() { result = this.getExpr().getControlFlowNode() } /** * Gets the underlying expression that updates the targeted assignable when @@ -492,7 +488,7 @@ class AssignableDefinition extends TAssignableDefinition { */ pragma[nomagic] AssignableRead getAFirstRead() { - forex(ControlFlowNode cfn | cfn = result.getAControlFlowNode() | + exists(ControlFlowNode cfn | cfn = result.getControlFlowNode() | exists(Ssa::ExplicitDefinition def | result = def.getAFirstReadAtNode(cfn) | this = def.getADefinition() ) @@ -572,7 +568,7 @@ module AssignableDefinitions { /** Holds if a node in basic block `bb` assigns to `ref` parameter `p` via definition `def`. */ private predicate basicBlockRefParamDef(BasicBlock bb, Parameter p, AssignableDefinition def) { def = any(RefArg arg).getAnAnalyzableRefDef(p) and - bb.getANode() = def.getExpr().getAControlFlowNode() + bb.getANode() = def.getExpr().getControlFlowNode() } /** diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowElement.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowElement.qll index 8db76e71619..f2b459b63f7 100644 --- a/csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowElement.qll +++ b/csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowElement.qll @@ -16,9 +16,7 @@ class ControlFlowElementOrCallable extends ExprOrStmtParent, TControlFlowElement * an expression. * * A control flow element can be mapped to a control flow node (`ControlFlowNode`) - * via `getAControlFlowNode()`. There is a one-to-many relationship between - * control flow elements and control flow nodes. This allows control flow - * splitting, for example modeling the control flow through `finally` blocks. + * via `getControlFlowNode()`. */ class ControlFlowElement extends ControlFlowElementOrCallable, @control_flow_element { /** Gets the enclosing callable of this element, if any. */ @@ -33,22 +31,26 @@ class ControlFlowElement extends ControlFlowElementOrCallable, @control_flow_ele } /** + * DEPRECATED: Use `getControlFlowNode()` instead. + * * Gets a control flow node for this element. That is, a node in the * control flow graph that corresponds to this element. */ - ControlFlowNodes::ElementNode getAControlFlowNode() { result = this.getControlFlowNode() } + deprecated ControlFlowNodes::ElementNode getAControlFlowNode() { + result = this.getControlFlowNode() + } /** Gets the control flow node for this element, if any. */ ControlFlowNode getControlFlowNode() { result.injects(this) } /** Gets the basic block in which this element occurs. */ - BasicBlock getBasicBlock() { result = this.getAControlFlowNode().getBasicBlock() } + BasicBlock getBasicBlock() { result = this.getControlFlowNode().getBasicBlock() } /** * Holds if this element is live, that is this element can be reached * from the entry point of its enclosing callable. */ - predicate isLive() { exists(this.getAControlFlowNode()) } + predicate isLive() { exists(this.getControlFlowNode()) } /** Holds if the current element is reachable from `src`. */ // potentially very large predicate, so must be inlined @@ -61,13 +63,13 @@ class ControlFlowElement extends ControlFlowElementOrCallable, @control_flow_ele ControlFlowElement getAReachableElement() { // Reachable in same basic block exists(BasicBlock bb, int i, int j | - bb.getNode(i) = this.getAControlFlowNode() and - bb.getNode(j) = result.getAControlFlowNode() and + bb.getNode(i) = this.getControlFlowNode() and + bb.getNode(j) = result.getControlFlowNode() and i < j ) or // Reachable in different basic blocks - this.getAControlFlowNode().getBasicBlock().getASuccessor+().getANode() = - result.getAControlFlowNode() + this.getControlFlowNode().getBasicBlock().getASuccessor+().getANode() = + result.getControlFlowNode() } } diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll index 0b07e049fac..a97d8f9738e 100644 --- a/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll +++ b/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll @@ -1073,7 +1073,7 @@ module Internal { candidateAux(x, d, bb) and y = any(AccessOrCallExpr e | - e.getAControlFlowNode().getBasicBlock() = bb and + e.getControlFlowNode().getBasicBlock() = bb and e.getTarget() = d ) ) @@ -1109,7 +1109,7 @@ module Internal { AccessOrCallExpr sub, GuardValue v ) { Stages::GuardsStage::forceCachingInSameStage() and - guardedCfn = guarded.getAControlFlowNode() and + guardedCfn = guarded.getControlFlowNode() and guardedBB = guardedCfn.getBasicBlock() and guardControls(g, guardedBB, v) and guardControlsSubSame(g, guardedBB, sub) and @@ -1152,9 +1152,7 @@ module Internal { private predicate isGuardedByExpr0( AccessOrCallExpr guarded, Guard g, AccessOrCallExpr sub, GuardValue v ) { - forex(ControlFlowNode cfn | cfn = guarded.getAControlFlowNode() | - nodeIsGuardedBySameSubExpr(cfn, _, guarded, g, sub, v) - ) + nodeIsGuardedBySameSubExpr(guarded.getControlFlowNode(), _, guarded, g, sub, v) } cached diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/Nullness.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/Nullness.qll index fa4a7fa50f8..d36fb68b915 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/Nullness.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/Nullness.qll @@ -259,7 +259,7 @@ private predicate defReaches(Ssa::Definition def, ControlFlowNode cfn) { or exists(ControlFlowNode mid | defReaches(def, mid) | SsaImpl::adjacentReadPairSameVar(_, mid, cfn) and - not mid = any(Dereference d | d.isAlwaysNull(def.getSourceVariable())).getAControlFlowNode() + not mid = any(Dereference d | d.isAlwaysNull(def.getSourceVariable())).getControlFlowNode() ) } @@ -384,6 +384,6 @@ class Dereference extends G::DereferenceableExpr { */ predicate isFirstAlwaysNull(Ssa::SourceVariable v) { this.isAlwaysNull(v) and - defReaches(v.getAnSsaDefinition(), this.getAControlFlowNode()) + defReaches(v.getAnSsaDefinition(), this.getControlFlowNode()) } } diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll index 87710acd262..ae875e97c6d 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll @@ -308,7 +308,7 @@ module Ssa { */ final AssignableRead getAFirstReadAtNode(ControlFlowNode cfn) { SsaImpl::firstReadSameVar(this, cfn) and - result.getAControlFlowNode() = cfn + result.getControlFlowNode() = cfn } /** @@ -371,7 +371,7 @@ module Ssa { */ deprecated final AssignableRead getALastReadAtNode(ControlFlowNode cfn) { SsaImpl::lastReadSameVar(this, cfn) and - result.getAControlFlowNode() = cfn + result.getControlFlowNode() = cfn } /** diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/SignAnalysis.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/SignAnalysis.qll index e7d3590e0fd..e1d804e6548 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/SignAnalysis.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/SignAnalysis.qll @@ -11,27 +11,23 @@ private import semmle.code.csharp.dataflow.internal.rangeanalysis.SignAnalysisCo /** Holds if `e` can be positive and cannot be negative. */ predicate positiveExpr(Expr e) { - forex(ControlFlowNode cfn | cfn = e.getAControlFlowNode() | + exists(ControlFlowNode cfn | cfn = e.getControlFlowNode() | positive(cfn) or strictlyPositive(cfn) ) } /** Holds if `e` can be negative and cannot be positive. */ predicate negativeExpr(Expr e) { - forex(ControlFlowNode cfn | cfn = e.getAControlFlowNode() | + exists(ControlFlowNode cfn | cfn = e.getControlFlowNode() | negative(cfn) or strictlyNegative(cfn) ) } /** Holds if `e` is strictly positive. */ -predicate strictlyPositiveExpr(Expr e) { - forex(ControlFlowNode cfn | cfn = e.getAControlFlowNode() | strictlyPositive(cfn)) -} +predicate strictlyPositiveExpr(Expr e) { strictlyPositive(e.getControlFlowNode()) } /** Holds if `e` is strictly negative. */ -predicate strictlyNegativeExpr(Expr e) { - forex(ControlFlowNode cfn | cfn = e.getAControlFlowNode() | strictlyNegative(cfn)) -} +predicate strictlyNegativeExpr(Expr e) { strictlyNegative(e.getControlFlowNode()) } /** Holds if `e` can be positive and cannot be negative. */ predicate positive(ControlFlowNodes::ExprNode e) { Common::positive(e) } diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll index 3af93ee2945..4f37508f9a2 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll @@ -14,7 +14,7 @@ module BaseSsa { private predicate definitionAt( AssignableDefinition def, BasicBlock bb, int i, SsaInput::SourceVariable v ) { - bb.getNode(i) = def.getExpr().getAControlFlowNode() and + bb.getNode(i) = def.getExpr().getControlFlowNode() and v = def.getTarget() and // In cases like `(x, x) = (0, 1)`, we discard the first (dead) definition of `x` not exists(TupleAssignmentDefinition first, TupleAssignmentDefinition second | first = def | @@ -95,7 +95,7 @@ module BaseSsa { predicate variableRead(BasicBlock bb, int i, SourceVariable v, boolean certain) { exists(AssignableRead read | - read.getAControlFlowNode() = bb.getNode(i) and + read.getControlFlowNode() = bb.getNode(i) and read.getTarget() = v and certain = true ) @@ -108,7 +108,7 @@ module BaseSsa { final AssignableRead getARead() { exists(BasicBlock bb, int i | SsaImpl::ssaDefReachesRead(_, this, bb, i) and - result.getAControlFlowNode() = bb.getNode(i) + result.getControlFlowNode() = bb.getNode(i) ) } diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll index 00a0ca06ae3..5b3bf5f2dae 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll @@ -44,10 +44,10 @@ predicate isArgumentNode(ArgumentNode arg, DataFlowCall c, ArgumentPosition pos) private ControlFlowNode getAPrimaryConstructorParameterCfn(ParameterAccess pa) { pa.getTarget().getCallable() instanceof PrimaryConstructor and ( - result = pa.(ParameterRead).getAControlFlowNode() + result = pa.(ParameterRead).getControlFlowNode() or pa = - any(AssignableDefinition def | result = def.getExpr().getAControlFlowNode()).getTargetAccess() + any(AssignableDefinition def | result = def.getExpr().getControlFlowNode()).getTargetAccess() ) } @@ -339,7 +339,7 @@ module VariableCapture { VariableWrite() { def.getTarget() = v.asLocalScopeVariable() and - this = def.getExpr().getAControlFlowNode() + this = def.getExpr().getControlFlowNode() } ControlFlowNode getRhs() { LocalFlow::defAssigns(def, this, _, result) } @@ -552,7 +552,7 @@ module LocalFlow { ) { def.getSource() = value and valueCfn = value.getControlFlowNode() and - cfnDef = def.getExpr().getAControlFlowNode() + cfnDef = def.getExpr().getControlFlowNode() } private predicate defAssigns(ExprNode value, AssignableDefinitionNode defNode) { @@ -1012,7 +1012,7 @@ private module Cached { TExprNode(ControlFlowNodes::ElementNode cfn) { exists(cfn.asExpr()) } or TSsaNode(SsaImpl::DataFlowIntegration::SsaNode node) or TAssignableDefinitionNode(AssignableDefinition def, ControlFlowNode cfn) { - cfn = def.getExpr().getAControlFlowNode() + cfn = def.getExpr().getControlFlowNode() } or TExplicitParameterNode(Parameter p, DataFlowCallable c) { p = c.asCallable(_).(CallableUsedInSource).getAParameter() @@ -1055,7 +1055,7 @@ private module Cached { // needed for reverse stores; e.g. `x.f1.f2 = y` induces // a store step of `f1` into `x` exists(TExprPostUpdateNode upd, Expr read | - upd = TExprPostUpdateNode(read.getAControlFlowNode()) + upd = TExprPostUpdateNode(read.getControlFlowNode()) | fieldOrPropertyRead(e, _, read) or @@ -1071,7 +1071,7 @@ private module Cached { sn.getSummarizedCallable() instanceof CallableUsedInSource } or TParamsArgumentNode(ControlFlowNode callCfn) { - callCfn = any(Call c | isParamsArg(c, _, _)).getAControlFlowNode() + callCfn = any(Call c | isParamsArg(c, _, _)).getControlFlowNode() } or TFlowInsensitiveFieldNode(FieldOrPropertyUsedInSource f) { f.isFieldLike() } or TFlowInsensitiveCapturedVariableNode(LocalScopeVariable v) { v.isCaptured() } or @@ -1533,7 +1533,7 @@ private module ArgumentNodes { ParamsArgumentNode() { this = TParamsArgumentNode(callCfn) } private Parameter getParameter() { - callCfn = any(Call c | isParamsArg(c, _, result)).getAControlFlowNode() + callCfn = any(Call c | isParamsArg(c, _, result)).getControlFlowNode() } override predicate argumentOf(DataFlowCall call, ArgumentPosition pos) { @@ -1619,7 +1619,7 @@ private module ReturnNodes { private ControlFlowNodes::ElementNode cfn; private YieldReturnStmt yrs; - YieldReturnNode() { this = TYieldReturnNode(cfn) and yrs.getExpr().getAControlFlowNode() = cfn } + YieldReturnNode() { this = TYieldReturnNode(cfn) and yrs.getExpr().getControlFlowNode() = cfn } YieldReturnStmt getYieldReturnStmt() { result = yrs } @@ -2534,7 +2534,7 @@ module PostUpdateNodes { class ObjectCreationNode extends SourcePostUpdateNode, ExprNode, TExprNode { private ObjectCreation oc; - ObjectCreationNode() { this = TExprNode(oc.getAControlFlowNode()) } + ObjectCreationNode() { this = TExprNode(oc.getControlFlowNode()) } override Node getPreUpdateSourceNode() { exists(ControlFlowNodes::ElementNode cfn | this = TExprNode(cfn) | @@ -2561,7 +2561,7 @@ module PostUpdateNodes { ObjectInitializerNode() { this = TObjectInitializerNode(cfn) and - cfn = oc.getAControlFlowNode() + cfn = oc.getControlFlowNode() } /** Gets the initializer to which this initializer node belongs. */ diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll index d4842ba89cc..0a8a4680191 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll @@ -126,7 +126,7 @@ private module SourceVariableImpl { */ predicate variableDefinition(BasicBlock bb, int i, Ssa::SourceVariable v, AssignableDefinition ad) { ad = v.getADefinition() and - ad.getExpr().getAControlFlowNode() = bb.getNode(i) and + ad.getExpr().getControlFlowNode() = bb.getNode(i) and // In cases like `(x, x) = (0, 1)`, we discard the first (dead) definition of `x` not exists(TupleAssignmentDefinition first, TupleAssignmentDefinition second | first = ad | second.getAssignment() = first.getAssignment() and @@ -217,7 +217,7 @@ private module SourceVariableImpl { def.getTarget() = lv and lv.isRef() and lv = v.getAssignable() and - bb.getNode(i) = def.getExpr().getAControlFlowNode() and + bb.getNode(i) = def.getExpr().getControlFlowNode() and not def.getAssignment() instanceof LocalVariableDeclAndInitExpr ) } @@ -888,7 +888,7 @@ private module Cached { Impl::ssaDefReachesRead(v, def, bb, i) and variableReadActual(bb, i, v) and cfn = bb.getNode(i) and - result.getAControlFlowNode() = cfn + result.getControlFlowNode() = cfn ) } diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll index 38d1b250618..f6dd4911256 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll @@ -254,7 +254,7 @@ private module Impl { Guard getComparisonGuard(ComparisonExpr ce) { result = ce.getExpr() } private newtype TComparisonExpr = - MkComparisonExpr(ComparisonTest ct, ExprNode e) { e = ct.getExpr().getAControlFlowNode() } + MkComparisonExpr(ComparisonTest ct, ExprNode e) { e = ct.getExpr().getControlFlowNode() } /** A relational comparison */ class ComparisonExpr extends MkComparisonExpr { diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionSpecific.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionSpecific.qll index c5510952804..6da6ec8b11e 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionSpecific.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionSpecific.qll @@ -12,9 +12,7 @@ class SsaPhiNode = CS::Ssa::PhiNode; class BasicBlock = CS::BasicBlock; /** Gets a basic block in which SSA variable `v` is read. */ -BasicBlock getAReadBasicBlock(SsaVariable v) { - result = v.getARead().getAControlFlowNode().getBasicBlock() -} +BasicBlock getAReadBasicBlock(SsaVariable v) { result = v.getARead().getBasicBlock() } private class PhiInputEdgeBlock extends BasicBlock { PhiInputEdgeBlock() { this = any(SsaReadPositionPhiInputEdge edge).getOrigBlock() } diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll index b00459c64b0..d191f62aa92 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll @@ -126,7 +126,7 @@ private class SystemDiagnosticsFormatMethods extends FormatMethodImpl { pragma[nomagic] private predicate parameterReadPostDominatesEntry(ParameterRead pr) { - pr.getAControlFlowNode().postDominates(pr.getEnclosingCallable().getEntryPoint()) and + pr.getControlFlowNode().postDominates(pr.getEnclosingCallable().getEntryPoint()) and getParameterType(pr.getTarget()) instanceof ObjectType } diff --git a/csharp/ql/src/Concurrency/UnsynchronizedStaticAccess.ql b/csharp/ql/src/Concurrency/UnsynchronizedStaticAccess.ql index bcb134a4e73..340663c6701 100644 --- a/csharp/ql/src/Concurrency/UnsynchronizedStaticAccess.ql +++ b/csharp/ql/src/Concurrency/UnsynchronizedStaticAccess.ql @@ -22,7 +22,7 @@ predicate correctlySynchronized(CollectionMember c, Expr access) { ( c.getType().(ValueOrRefType).getABaseType*().getName().matches("Concurrent%") or access.getEnclosingStmt().getParent*() instanceof LockStmt or - any(LockingCall call).getAControlFlowNode().getASuccessor+() = access.getAControlFlowNode() + any(LockingCall call).getControlFlowNode().getASuccessor+() = access.getControlFlowNode() ) } diff --git a/csharp/ql/src/Dead Code/DeadStoreOfLocal.ql b/csharp/ql/src/Dead Code/DeadStoreOfLocal.ql index 59816a18b3f..12baac99c78 100644 --- a/csharp/ql/src/Dead Code/DeadStoreOfLocal.ql +++ b/csharp/ql/src/Dead Code/DeadStoreOfLocal.ql @@ -131,7 +131,7 @@ class RelevantDefinition extends AssignableDefinition { /** Holds if this definition is dead and we want to report it. */ predicate isDead() { // Ensure that the definition is not in dead code - exists(this.getExpr().getAControlFlowNode()) and + exists(this.getExpr().getControlFlowNode()) and not this.isMaybeLive() and // Allow dead initializer assignments, such as `string s = string.Empty`, but only // if the initializer expression assigns a default-like value, and there exists another diff --git a/csharp/ql/src/Likely Bugs/Statements/UseBraces.ql b/csharp/ql/src/Likely Bugs/Statements/UseBraces.ql index bef3fabd296..39f0bfddf6a 100644 --- a/csharp/ql/src/Likely Bugs/Statements/UseBraces.ql +++ b/csharp/ql/src/Likely Bugs/Statements/UseBraces.ql @@ -23,7 +23,7 @@ Stmt findSuccessorStmt(ControlFlowNode n) { // Return a successor statement to s Stmt getASuccessorStmt(Stmt s) { - result = findSuccessorStmt(s.getAControlFlowNode().getASuccessor()) + result = findSuccessorStmt(s.getControlFlowNode().getASuccessor()) } class IfThenStmt extends IfStmt { diff --git a/csharp/ql/src/Likely Bugs/UncheckedCastInEquals.ql b/csharp/ql/src/Likely Bugs/UncheckedCastInEquals.ql index 0b59ea92824..0b87b12041a 100644 --- a/csharp/ql/src/Likely Bugs/UncheckedCastInEquals.ql +++ b/csharp/ql/src/Likely Bugs/UncheckedCastInEquals.ql @@ -30,5 +30,5 @@ from ParameterAccess access, CastExpr cast where access = cast.getAChild() and access.getTarget().getDeclaringElement() = access.getEnclosingCallable() and - nodeBeforeParameterAccess(access.getAControlFlowNode()) + nodeBeforeParameterAccess(access.getControlFlowNode()) select cast, "Equals() method does not check argument type." diff --git a/csharp/ql/src/Performance/StringBuilderInLoop.ql b/csharp/ql/src/Performance/StringBuilderInLoop.ql index f2a13923478..1f7e24988ce 100644 --- a/csharp/ql/src/Performance/StringBuilderInLoop.ql +++ b/csharp/ql/src/Performance/StringBuilderInLoop.ql @@ -18,5 +18,5 @@ where creation.getType() instanceof SystemTextStringBuilderClass and loopEntryNode.isBefore(loop.getBody()) and loop.getBody().getAChild*() = creation and - creation.getAControlFlowNode().postDominates(loopEntryNode) + creation.getControlFlowNode().postDominates(loopEntryNode) select creation, "Creating a 'StringBuilder' in a loop." diff --git a/csharp/ql/src/Useless code/DefaultToStringQuery.qll b/csharp/ql/src/Useless code/DefaultToStringQuery.qll index 411ca47b5e6..cd7a1419028 100644 --- a/csharp/ql/src/Useless code/DefaultToStringQuery.qll +++ b/csharp/ql/src/Useless code/DefaultToStringQuery.qll @@ -30,7 +30,7 @@ predicate invokesToString(Expr e, ValueOrRefType t) { pragma[nomagic] private predicate parameterReadPostDominatesEntry(ParameterRead pr) { - pr.getAControlFlowNode().postDominates(pr.getEnclosingCallable().getEntryPoint()) + pr.getControlFlowNode().postDominates(pr.getEnclosingCallable().getEntryPoint()) } pragma[nomagic] diff --git a/csharp/ql/test/library-tests/assignables/AssignableDefinitionNode.ql b/csharp/ql/test/library-tests/assignables/AssignableDefinitionNode.ql index 8ff3aad95fc..2e4af6cfe9b 100644 --- a/csharp/ql/test/library-tests/assignables/AssignableDefinitionNode.ql +++ b/csharp/ql/test/library-tests/assignables/AssignableDefinitionNode.ql @@ -1,4 +1,4 @@ import csharp from AssignableDefinition def -select def, def.getExpr().getAControlFlowNode() +select def, def.getExpr().getControlFlowNode() diff --git a/csharp/ql/test/library-tests/csharp7/IsFlow.ql b/csharp/ql/test/library-tests/csharp7/IsFlow.ql index ccd51760504..0567ea5828f 100644 --- a/csharp/ql/test/library-tests/csharp7/IsFlow.ql +++ b/csharp/ql/test/library-tests/csharp7/IsFlow.ql @@ -2,7 +2,7 @@ import csharp query predicate edges(ControlFlowNode n1, ControlFlowNode n2, string attr, string val) { exists(SwitchStmt switch, ControlFlow::SuccessorType t | - switch.getAControlFlowNode().getASuccessor*() = n1 + switch.getControlFlowNode().getASuccessor*() = n1 | n2 = n1.getASuccessor(t) and attr = "semmle.label" and diff --git a/csharp/ql/test/library-tests/dataflow/defuse/defUseEquivalence.ql b/csharp/ql/test/library-tests/dataflow/defuse/defUseEquivalence.ql index 19037a80e6c..abac840ab10 100644 --- a/csharp/ql/test/library-tests/dataflow/defuse/defUseEquivalence.ql +++ b/csharp/ql/test/library-tests/dataflow/defuse/defUseEquivalence.ql @@ -5,20 +5,20 @@ private import semmle.code.csharp.dataflow.internal.BaseSSA predicate defReaches( AssignableDefinition def, BaseSsa::SimpleLocalScopeVariable v, ControlFlowNode cfn ) { - def.getTarget() = v and cfn = def.getExpr().getAControlFlowNode().getASuccessor() + def.getTarget() = v and cfn = def.getExpr().getControlFlowNode().getASuccessor() or exists(ControlFlowNode mid | defReaches(def, v, mid) | not mid = any(AssignableDefinition ad | ad.getTarget() = v and ad.isCertain()) .getExpr() - .getAControlFlowNode() and + .getControlFlowNode() and cfn = mid.getASuccessor() ) } predicate defUsePair(AssignableDefinition def, AssignableRead read) { exists(Assignable a | - defReaches(def, a, read.getAControlFlowNode()) and + defReaches(def, a, read.getControlFlowNode()) and read.getTarget() = a ) } diff --git a/csharp/ql/test/library-tests/dataflow/defuse/parameterUseEquivalence.ql b/csharp/ql/test/library-tests/dataflow/defuse/parameterUseEquivalence.ql index abb84e3741c..e4216f89942 100644 --- a/csharp/ql/test/library-tests/dataflow/defuse/parameterUseEquivalence.ql +++ b/csharp/ql/test/library-tests/dataflow/defuse/parameterUseEquivalence.ql @@ -10,13 +10,13 @@ predicate parameterReaches(Parameter p, ControlFlowNode cfn) { not mid = any(AssignableDefinition ad | ad.getTarget() = p and ad.isCertain()) .getExpr() - .getAControlFlowNode() and + .getControlFlowNode() and cfn = mid.getASuccessor() ) } predicate parameterUsePair(Parameter p, AssignableRead read) { - parameterReaches(p, read.getAControlFlowNode()) and + parameterReaches(p, read.getControlFlowNode()) and read.getTarget() = p } diff --git a/csharp/ql/test/library-tests/dataflow/defuse/useUseEquivalence.ql b/csharp/ql/test/library-tests/dataflow/defuse/useUseEquivalence.ql index 4c189ca0274..bc3d6d422a6 100644 --- a/csharp/ql/test/library-tests/dataflow/defuse/useUseEquivalence.ql +++ b/csharp/ql/test/library-tests/dataflow/defuse/useUseEquivalence.ql @@ -5,20 +5,20 @@ private import semmle.code.csharp.dataflow.internal.BaseSSA predicate useReaches( LocalScopeVariableRead read, BaseSsa::SimpleLocalScopeVariable v, ControlFlowNode cfn ) { - read.getTarget() = v and cfn = read.getAControlFlowNode().getASuccessor() + read.getTarget() = v and cfn = read.getControlFlowNode().getASuccessor() or exists(ControlFlowNode mid | useReaches(read, v, mid) | not mid = any(AssignableDefinition ad | ad.getTarget() = v and ad.isCertain()) .getExpr() - .getAControlFlowNode() and + .getControlFlowNode() and cfn = mid.getASuccessor() ) } predicate useUsePair(LocalScopeVariableRead read1, LocalScopeVariableRead read2) { exists(Assignable a | - useReaches(read1, a, read2.getAControlFlowNode()) and + useReaches(read1, a, read2.getControlFlowNode()) and read2.getTarget() = a ) }