From de96b5acfd8910ec6e4970f5c3bad0362d01f3c4 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Tue, 28 Apr 2026 11:15:13 +0200 Subject: [PATCH] C#: Deprecate Ssa::ImplicitDefinition. --- csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll | 8 +++++--- .../code/csharp/dataflow/internal/DataFlowPrivate.qll | 4 ++-- .../internal/rangeanalysis/SignAnalysisSpecific.qll | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll index edc7e6a6a89..be265188e5d 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll @@ -509,13 +509,15 @@ module Ssa { } /** + * DEPRECATED: Use `SsaParameterInit` or `SsaImplicitWrite` instead. + * * An SSA definition that does not correspond to an explicit variable definition. * Either an implicit initialization of a variable at the beginning of a callable * (`ImplicitEntryDefinition`), an implicit definition via a call * (`ImplicitCallDefinition`), or an implicit definition where the qualifier is * updated (`ImplicitQualifierDefinition`). */ - class ImplicitDefinition extends Definition, SsaImpl::WriteDefinition { + deprecated class ImplicitDefinition extends Definition, SsaImpl::WriteDefinition { ImplicitDefinition() { exists(BasicBlock bb, SourceVariable v, int i | this.definesAt(v, bb, i) | SsaImpl::implicitEntryDefinition(bb, v) and @@ -596,7 +598,7 @@ module Ssa { * An SSA definition representing the potential definition of a variable * via a call. */ - class ImplicitCallDefinition extends ImplicitDefinition { + class ImplicitCallDefinition extends SsaImplicitWrite { private Call c; ImplicitCallDefinition() { @@ -629,7 +631,7 @@ module Ssa { * An SSA definition representing the potential definition of a variable * via an SSA definition for the qualifier. */ - class ImplicitQualifierDefinition extends ImplicitDefinition, SsaImpl::WriteDefinition { + class ImplicitQualifierDefinition extends SsaImplicitWrite { private Definition q; ImplicitQualifierDefinition() { 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 7b1d35c6e5a..ccf65ddb37c 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll @@ -2008,9 +2008,9 @@ private class FieldOrPropertyRead extends FieldOrPropertyAccess, AssignableRead * SSA updates. */ predicate hasNonlocalValue() { - exists(SsaDefinition def, Ssa::ImplicitDefinition idef | + exists(SsaDefinition def | def.getARead() = this and - idef = def.getAnUltimateDefinition() + def.getAnUltimateDefinition() instanceof SsaImplicitWrite ) } } 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 77e30d239fd..48ed00858a0 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 @@ -144,12 +144,12 @@ private module Impl { } /** Gets the variable underlying the implicit SSA variable `def`. */ - Declaration getImplicitSsaDeclaration(Ssa::ImplicitDefinition def) { + Declaration getImplicitSsaDeclaration(SsaImplicitWrite def) { result = def.getSourceVariable().getAssignable() } /** Holds if the variable underlying the implicit SSA variable `def` is not a field. */ - predicate nonFieldImplicitSsaDefinition(Ssa::ImplicitDefinition def) { + predicate nonFieldImplicitSsaDefinition(SsaImplicitWrite def) { not getImplicitSsaDeclaration(def) instanceof Field }