C#: Reinstate toString for SSA data flow nodes.

This commit is contained in:
Anders Schack-Mulligen
2026-04-28 13:38:14 +02:00
parent bedadc9f04
commit e0421dbf53
3 changed files with 7 additions and 15 deletions

View File

@@ -506,8 +506,6 @@ module Ssa {
}
override Element getElement() { result = ad.getElement() }
override string toString() { result = "SSA def(" + this.getSourceVariable() + ")" }
}
/**
@@ -551,12 +549,6 @@ module Ssa {
final Callable getCallable() { result = this.getBasicBlock().getEnclosingCallable() }
override Element getElement() { result = this.getCallable() }
override string toString() {
if this.getSourceVariable().getAssignable() instanceof LocalScopeVariable
then result = "SSA capture def(" + this.getSourceVariable() + ")"
else result = "SSA entry def(" + this.getSourceVariable() + ")"
}
}
/**
@@ -590,10 +582,6 @@ module Ssa {
/** Gets the parameter that this entry definition represents. */
Parameter getParameter() { result = p }
override string toString() {
result = "SSA param_default(" + pragma[only_bind_out](this.getParameter()) + ")"
}
}
/**
@@ -687,8 +675,6 @@ module Ssa {
predicate hasInputFromBlock(Definition inp, BasicBlock bb) {
inp = SsaImpl::phiHasInputFromBlock(this, bb)
}
override string toString() { result = "SSA phi(" + this.getSourceVariable() + ")" }
}
/**

View File

@@ -78,6 +78,10 @@ module Ssa_ = Impl::MakeSsa<SsaInput>;
class Definition = Impl::Definition;
private class SsaDefinitionToStringProxy extends Definition {
override string toString() { result = this.(SsaDefinition).toString() }
}
deprecated class WriteDefinition = Impl::WriteDefinition;
deprecated class UncertainWriteDefinition = Impl::UncertainWriteDefinition;

View File

@@ -1054,7 +1054,7 @@ module Make<
/** A static single assignment (SSA) definition. */
class SsaDefinition extends FinalDefinition {
/** Gets a textual representation of this SSA definition. */
string toString() { result = super.toString() }
string toString() { result = "SSA def(" + this.getSourceVariable() + ")" }
/**
* Gets the control flow node of this SSA definition.
@@ -1207,6 +1207,8 @@ module Make<
* a phi definition for `x` is inserted just before the call `puts x`.
*/
class SsaPhiDefinition extends SsaDefinition instanceof PhiNode {
override string toString() { result = "SSA phi(" + this.getSourceVariable() + ")" }
/** Holds if `inp` is an input to this phi definition along the edge originating in `bb`. */
predicate hasInputFromBlock(SsaDefinition inp, BasicBlock bb) {
phiHasInputFromBlockCached(this, inp, bb)