Skip to content

Commit

Permalink
C#: Remove remaining DefinitionExt references.
Browse files Browse the repository at this point in the history
  • Loading branch information
aschackmull committed Feb 27, 2025
1 parent 79069ce commit 17f0041
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll
Original file line number Diff line number Diff line change
@@ -994,9 +994,9 @@ private module Cached {

import Cached

private string getSplitString(DefinitionExt def) {
private string getSplitString(Definition def) {
exists(ControlFlow::BasicBlock bb, int i, ControlFlow::Node cfn |
def.definesAt(_, bb, i, _) and
def.definesAt(_, bb, i) and
result = cfn.(ControlFlow::Nodes::ElementNode).getSplitsString()
|
cfn = bb.getNode(i)
@@ -1006,48 +1006,13 @@ private string getSplitString(DefinitionExt def) {
)
}

string getToStringPrefix(DefinitionExt def) {
string getToStringPrefix(Definition def) {
result = "[" + getSplitString(def) + "] "
or
not exists(getSplitString(def)) and
result = ""
}

/**
* An extended static single assignment (SSA) definition.
*
* This is either a normal SSA definition (`Definition`) or a
* phi-read node (`PhiReadNode`).
*
* Only intended for internal use.
*/
class DefinitionExt extends Impl::DefinitionExt {
override string toString() { result = this.(Ssa::Definition).toString() }

/** Gets the location of this definition. */
override Location getLocation() { result = this.(Ssa::Definition).getLocation() }

/** Gets the enclosing callable of this definition. */
Callable getEnclosingCallable() { result = this.(Ssa::Definition).getEnclosingCallable() }
}

/**
* A phi-read node.
*
* Only intended for internal use.
*/
class PhiReadNode extends DefinitionExt, Impl::PhiReadNode {
override string toString() {
result = getToStringPrefix(this) + "SSA phi read(" + this.getSourceVariable() + ")"
}

override Location getLocation() { result = this.getBasicBlock().getLocation() }

override Callable getEnclosingCallable() {
result = this.getSourceVariable().getEnclosingCallable()
}
}

private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInputSig {
private import csharp as Cs
private import semmle.code.csharp.controlflow.BasicBlocks

0 comments on commit 17f0041

Please sign in to comment.