diff --git a/csharp/ql/lib/semmle/code/csharp/Assignable.qll b/csharp/ql/lib/semmle/code/csharp/Assignable.qll index 5cd9ee9ede0..d2df0a5a05e 100644 --- a/csharp/ql/lib/semmle/code/csharp/Assignable.qll +++ b/csharp/ql/lib/semmle/code/csharp/Assignable.qll @@ -271,6 +271,8 @@ module AssignableInternal { def = TPatternDefinition(result) or def = TAssignOperationDefinition(result) + or + def = TParameterDefaultDefinition(_, result) } /** A local variable declaration at the top-level of a pattern. */ @@ -308,10 +310,17 @@ module AssignableInternal { exists(Callable c | p = c.getAParameter() | c.hasBody() or - // Same as `c.(Constructor).hasInitializer()`, but avoids negative recursion warning - c.getAChildExpr() instanceof @constructor_init_expr + c.(Constructor).hasInitializer() ) } or + TParameterDefaultDefinition(Parameter p, Expr default) { + exists(Callable c | p = c.getAParameter() | + c.hasBody() + or + c.(Constructor).hasInitializer() + ) and + default = p.getDefaultValue() + } or TAddressOfDefinition(AddressOfExpr aoe) or TPatternDefinition(TopLevelPatternDecl tlpd) or TAssignOperationDefinition(AssignOperation ao) { @@ -350,6 +359,8 @@ module AssignableInternal { any(AssignableDefinitions::PatternDefinition pd | result = pd.getDeclaration().getVariable()) or def = any(AssignableDefinitions::InitializerDefinition init | result = init.getAssignable()) + or + def = TParameterDefaultDefinition(result, _) } // Not defined by dispatch in order to avoid too conservative negative recursion error @@ -493,11 +504,6 @@ class AssignableDefinition extends TAssignableDefinition { exists(Ssa::ExplicitDefinition def | result = def.getAFirstReadAtNode(cfn) | this = def.getADefinition() ) - or - exists(Ssa::ImplicitParameterDefinition def | result = def.getAFirstReadAtNode(cfn) | - this.(AssignableDefinitions::ImplicitParameterDefinition).getParameter() = - def.getParameter() - ) ) } @@ -689,7 +695,33 @@ module AssignableDefinitions { override string toString() { result = p.toString() } - override Location getLocation() { result = this.getTarget().getLocation() } + override Location getLocation() { result = p.getLocation() } + } + + /** + * A default value assigned to a parameter. + */ + class ParameterDefaultDefinition extends AssignableDefinition, TParameterDefaultDefinition { + Parameter p; + Expr default; + + ParameterDefaultDefinition() { this = TParameterDefaultDefinition(p, default) } + + /** Gets the underlying parameter. */ + Parameter getParameter() { result = p } + + /** Gets the default value expression for the parameter. */ + Expr getDefaultValue() { result = default } + + override Expr getSource() { result = default } + + override Expr getElement() { result = default } + + override Callable getEnclosingCallable() { result = p.getCallable() } + + override string toString() { result = p.toString() + " = ..." } + + override Location getLocation() { result = default.getLocation() } } /** diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll index 52de1c2fe0e..a8fe2e432e2 100644 --- a/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll +++ b/csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll @@ -205,7 +205,7 @@ private module LogicInput implements GuardsImpl::LogicInputSig { } } - class SsaParameterInit extends SsaDefinition instanceof Ssa::ImplicitParameterDefinition { + class SsaParameterInit extends SsaDefinition instanceof Ssa::ParameterDefinition { Parameter getParameter() { result = super.getParameter() } } diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/Nullness.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/Nullness.qll index d36fb68b915..14d343dedfb 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/Nullness.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/Nullness.qll @@ -130,7 +130,7 @@ private predicate dereferenceAt(ControlFlowNode node, Ssa::Definition def, Deref d = def.getAReadAtNode(node) } -private predicate isMaybeNullArgument(Ssa::ImplicitParameterDefinition def, MaybeNullExpr arg) { +private predicate isMaybeNullArgument(Ssa::ParameterDefinition def, MaybeNullExpr arg) { exists(AssignableDefinitions::ImplicitParameterDefinition pdef, Parameter p | p = def.getParameter() | @@ -181,7 +181,7 @@ private predicate hasMultipleParamsArguments(Call c) { ) } -private predicate isNullDefaultArgument(Ssa::ImplicitParameterDefinition def, AlwaysNullExpr arg) { +private predicate isNullDefaultArgument(Ssa::ParameterDefinition def, AlwaysNullExpr arg) { exists(AssignableDefinitions::ImplicitParameterDefinition pdef, Parameter p | p = def.getParameter() | @@ -337,8 +337,7 @@ class Dereference extends G::DereferenceableExpr { or p.fromSource() and exists( - Ssa::ImplicitParameterDefinition def, - AssignableDefinitions::ImplicitParameterDefinition pdef + Ssa::ParameterDefinition def, AssignableDefinitions::ImplicitParameterDefinition pdef | p = def.getParameter() | diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll index 92149e02640..8f5b04c6708 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll @@ -9,7 +9,6 @@ import csharp */ module Ssa { private import internal.SsaImpl as SsaImpl - private import semmle.code.csharp.internal.Location pragma[nomagic] private predicate assignableDefinitionLocalScopeVariable( @@ -19,15 +18,6 @@ module Ssa { ad.getEnclosingCallable() = c } - pragma[nomagic] - private predicate localScopeSourceVariable( - SourceVariables::LocalScopeSourceVariable sv, LocalScopeVariable v, Callable c1, Callable c2 - ) { - sv.getAssignable() = v and - sv.getEnclosingCallable() = c1 and - v.getCallable() = c2 - } - /** * A variable that can be SSA converted. * @@ -54,7 +44,7 @@ module Ssa { not exists(result.getTargetAccess()) and exists(LocalScopeVariable v, Callable c | assignableDefinitionLocalScopeVariable(result, v, c) and - localScopeSourceVariable(this, v, c, _) + SsaImpl::localScopeSourceVariable(this, v, c, _) ) } @@ -482,8 +472,8 @@ module Ssa { /** * An SSA definition representing the implicit initialization of a variable - * at the beginning of a callable. Either a parameter, a local scope variable - * captured by the callable, or a field or property accessed inside the callable. + * at the beginning of a callable. Either a local scope variable captured by + * the callable or a field or property accessed inside the callable. */ class ImplicitEntryDefinition extends ImplicitDefinition { ImplicitEntryDefinition() { @@ -507,51 +497,37 @@ module Ssa { override Location getLocation() { result = this.getCallable().getLocation() } } - private module NearestLocationInput implements NearestLocationInputSig { - class C = ImplicitParameterDefinition; + deprecated class ImplicitParameterDefinition = ParameterDefinition; - predicate relevantLocations(ImplicitParameterDefinition def, Location l1, Location l2) { - not def.getBasicBlock() instanceof EntryBasicBlock and - l1 = def.getParameter().getALocation() and - l2 = def.getBasicBlock().getLocation() - } - } + final class ParameterDefinition = SsaImpl::ParameterDefinitionImpl; - pragma[nomagic] - private predicate implicitEntryDef(ImplicitEntryDefinition def, SourceVariable v, Callable c) { - v = def.getSourceVariable() and - c = def.getCallable() + private class ExplicitParameterDefinition extends ExplicitDefinition, + SsaImpl::ParameterDefinitionImpl + { + private Parameter p; + override AssignableDefinitions::ImplicitParameterDefinition ad; + + ExplicitParameterDefinition() { p = ad.getParameter() } + + override Parameter getParameter() { result = p } + + override string toString() { result = SsaImpl::ParameterDefinitionImpl.super.toString() } } /** - * An SSA definition representing the implicit initialization of a parameter - * at the beginning of a callable. + * An SSA definition representing the default value of a parameter. */ - class ImplicitParameterDefinition extends ImplicitEntryDefinition { + class ParameterDefaultDefinition extends ExplicitDefinition { private Parameter p; + override AssignableDefinitions::ParameterDefaultDefinition ad; - ImplicitParameterDefinition() { - exists(SourceVariable sv, Callable c | - implicitEntryDef(this, sv, c) and - localScopeSourceVariable(sv, p, _, c) - ) - } + ParameterDefaultDefinition() { p = ad.getParameter() } /** Gets the parameter that this entry definition represents. */ Parameter getParameter() { result = p } - override Element getElement() { result = this.getParameter() } - override string toString() { - result = "SSA param(" + pragma[only_bind_out](this.getParameter()) + ")" - } - - override Location getLocation() { - not NearestLocation::nearestLocation(this, _, _) and - result = p.getLocation() - or - // multi-bodied method: use matching parameter location - NearestLocation::nearestLocation(this, result, _) + result = "SSA param_default(" + pragma[only_bind_out](this.getParameter()) + ")" } } 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 1352f6e9f9f..c4d2a844103 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll @@ -1303,7 +1303,7 @@ private module NearestLocationInputParamAfterCallable implements NearestLocation private module ParameterNodes { pragma[nomagic] - private predicate ssaParamDef(Ssa::ImplicitParameterDefinition ssaDef, Parameter p, Location l) { + private predicate ssaParamDef(Ssa::ParameterDefinition ssaDef, Parameter p, Location l) { p = ssaDef.getParameter() and l = ssaDef.getLocation() } @@ -1358,7 +1358,7 @@ private module ParameterNodes { } /** Gets the SSA definition corresponding to this parameter, if any. */ - Ssa::ImplicitParameterDefinition getSsaDefinition() { + Ssa::ParameterDefinition getSsaDefinition() { exists(Parameter p, Location l | l = this.getParameterLocation(p) and ssaParamDef(result, p, l) 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 b2c44598524..b3a95977be9 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll @@ -7,6 +7,7 @@ private import codeql.ssa.Ssa as SsaImplCommon private import AssignableDefinitions private import semmle.code.csharp.controlflow.Guards as Guards private import semmle.code.csharp.dataflow.internal.BaseSSA +private import semmle.code.csharp.internal.Location private module SsaInput implements SsaImplCommon::InputSig { class SourceVariable = Ssa::SourceVariable; @@ -126,7 +127,6 @@ private module SourceVariableImpl { */ predicate variableDefinition(BasicBlock bb, int i, Ssa::SourceVariable v, AssignableDefinition ad) { ad = v.getADefinition() 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 @@ -136,7 +136,13 @@ private module SourceVariableImpl { // In cases like `M(out x, out x)`, there is no inherent evaluation order, so we // collapse the two definitions of `x`, using the first access as the representative, // and expose both definitions in `ExplicitDefinition.getADefinition()` - not ad = getASameOutRefDefAfter(v, _) + not ad = getASameOutRefDefAfter(v, _) and + ( + ad.getExpr().getControlFlowNode() = bb.getNode(i) + or + ad.(AssignableDefinitions::ImplicitParameterDefinition).getParameter().getControlFlowNode() = + bb.getNode(i) + ) } /** @@ -243,6 +249,15 @@ private module SourceVariableImpl { private import SourceVariableImpl private import Ssa::SourceVariables +pragma[nomagic] +predicate localScopeSourceVariable( + Ssa::SourceVariables::LocalScopeSourceVariable sv, LocalScopeVariable v, Callable c1, Callable c2 +) { + sv.getAssignable() = v and + sv.getEnclosingCallable() = c1 and + v.getCallable() = c2 +} + private module CallGraph { private import semmle.code.csharp.dispatch.Dispatch @@ -767,9 +782,10 @@ private module Cached { v instanceof PlainFieldOrPropSourceVariable ) or - // In case `c` has multiple bodies, we want each body to get its own implicit - // entry definition, so we use the basic block containing the body instead of - // the entry block. + // In case `c` has multiple bodies, we want each body to get its own set of + // parameter definitions, so we add special writes to the start of the basic + // blocks containing the bodies + strictcount(c.getBody()) > 1 and v.getAssignable() instanceof Parameter and bb.getANode().isBefore(c.getBody()) ) @@ -962,7 +978,7 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu predicate ssaDefHasSource(WriteDefinition def) { // exclude flow directly from RHS to SSA definition, as we instead want to // go from RHS to matching assignable definition, and from there to SSA definition - def instanceof Ssa::ImplicitParameterDefinition + def instanceof Ssa::ParameterDefinition } /** @@ -994,3 +1010,56 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu } private module DataFlowIntegrationImpl = Impl::DataFlowIntegration; + +private module MultiBodyNearestLocationInput implements NearestLocationInputSig { + class C = MultiBodyParameterDefinition; + + predicate relevantLocations(MultiBodyParameterDefinition def, Location l1, Location l2) { + exists(Callable c, ControlFlowNode n | + l1 = def.getParameter().getALocation() and + n = def.getBasicBlock().getANode() and + n.isBefore(c.getBody()) and + l2 = n.getLocation() + ) + } +} + +pragma[nomagic] +private predicate implicitEntryDef( + Ssa::ImplicitEntryDefinition def, Ssa::SourceVariable v, Callable c +) { + v = def.getSourceVariable() and + c = def.getCallable() +} + +/** + * An SSA definition representing the implicit initialization of a parameter + * at the beginning of a callable. + */ +abstract class ParameterDefinitionImpl extends Ssa::Definition { + /** Gets the parameter that this definition represents. */ + abstract Parameter getParameter(); + + override string toString() { + result = "SSA param(" + pragma[only_bind_out](this.getParameter()) + ")" + } +} + +class MultiBodyParameterDefinition extends ParameterDefinitionImpl, Ssa::ImplicitEntryDefinition { + private Parameter p; + + MultiBodyParameterDefinition() { + exists(Ssa::SourceVariable sv, Callable c | + implicitEntryDef(this, sv, c) and + localScopeSourceVariable(sv, p, _, c) + ) + } + + override Parameter getParameter() { result = p } + + override string toString() { result = ParameterDefinitionImpl.super.toString() } + + override Location getLocation() { + NearestLocation::nearestLocation(this, result, _) + } +} diff --git a/csharp/ql/test/library-tests/csharp7/DefUse.ql b/csharp/ql/test/library-tests/csharp7/DefUse.ql index a37b867e086..5957c009260 100644 --- a/csharp/ql/test/library-tests/csharp7/DefUse.ql +++ b/csharp/ql/test/library-tests/csharp7/DefUse.ql @@ -6,7 +6,7 @@ where ( ult.(Ssa::ExplicitDefinition).getADefinition() = def or - ult.(Ssa::ImplicitParameterDefinition).getParameter() = + ult.(Ssa::ParameterDefinition).getParameter() = def.(AssignableDefinitions::ImplicitParameterDefinition).getParameter() ) and read = ssaDef.getARead() diff --git a/csharp/ql/test/library-tests/dataflow/defuse/parameterUseEquivalence.ql b/csharp/ql/test/library-tests/dataflow/defuse/parameterUseEquivalence.ql index e4216f89942..896092718a0 100644 --- a/csharp/ql/test/library-tests/dataflow/defuse/parameterUseEquivalence.ql +++ b/csharp/ql/test/library-tests/dataflow/defuse/parameterUseEquivalence.ql @@ -24,8 +24,7 @@ private LocalScopeVariableRead getAReachableUncertainRead( AssignableDefinitions::ImplicitParameterDefinition p ) { exists(Ssa::Definition ssaDef | - p.getParameter() = - ssaDef.getAnUltimateDefinition().(Ssa::ImplicitParameterDefinition).getParameter() + p.getParameter() = ssaDef.getAnUltimateDefinition().(Ssa::ParameterDefinition).getParameter() | result = ssaDef.getARead() ) diff --git a/csharp/ql/test/library-tests/dataflow/local/DataFlow.expected b/csharp/ql/test/library-tests/dataflow/local/DataFlow.expected index ed80fa1e8b3..ef002f0396f 100644 --- a/csharp/ql/test/library-tests/dataflow/local/DataFlow.expected +++ b/csharp/ql/test/library-tests/dataflow/local/DataFlow.expected @@ -5,6 +5,7 @@ | LocalDataFlow.cs:315:15:315:20 | access to local variable sink73 | | LocalDataFlow.cs:316:15:316:20 | access to local variable sink74 | | LocalDataFlow.cs:342:15:342:21 | access to parameter tainted | +| LocalDataFlow.cs:387:15:387:15 | access to parameter s | | SSA.cs:9:15:9:22 | access to local variable ssaSink0 | | SSA.cs:25:15:25:22 | access to local variable ssaSink1 | | SSA.cs:43:15:43:22 | access to local variable ssaSink2 | diff --git a/csharp/ql/test/library-tests/dataflow/local/DataFlowStep.expected b/csharp/ql/test/library-tests/dataflow/local/DataFlowStep.expected index a22e56b0dd8..d1df5b77de0 100644 --- a/csharp/ql/test/library-tests/dataflow/local/DataFlowStep.expected +++ b/csharp/ql/test/library-tests/dataflow/local/DataFlowStep.expected @@ -529,6 +529,9 @@ | LocalDataFlow.cs:381:17:381:29 | "not tainted" | LocalDataFlow.cs:381:13:381:13 | access to local variable x | | LocalDataFlow.cs:385:34:385:34 | SSA param(s) | LocalDataFlow.cs:387:15:387:15 | access to parameter s | | LocalDataFlow.cs:385:34:385:34 | s | LocalDataFlow.cs:385:34:385:34 | SSA param(s) | +| LocalDataFlow.cs:385:38:385:51 | "taint source" | LocalDataFlow.cs:385:38:385:51 | s = ... | +| LocalDataFlow.cs:385:38:385:51 | SSA param_default(s) | LocalDataFlow.cs:387:15:387:15 | access to parameter s | +| LocalDataFlow.cs:385:38:385:51 | s = ... | LocalDataFlow.cs:385:38:385:51 | SSA param_default(s) | | SSA.cs:3:14:3:16 | this | SSA.cs:3:14:3:16 | this access | | SSA.cs:5:17:5:17 | SSA entry def(this.S) | SSA.cs:67:9:67:14 | access to field S | | SSA.cs:5:17:5:17 | this | SSA.cs:67:9:67:12 | this access | diff --git a/csharp/ql/test/library-tests/dataflow/local/TaintTracking.expected b/csharp/ql/test/library-tests/dataflow/local/TaintTracking.expected index 372d0bfb3e1..a7ba919f2d7 100644 --- a/csharp/ql/test/library-tests/dataflow/local/TaintTracking.expected +++ b/csharp/ql/test/library-tests/dataflow/local/TaintTracking.expected @@ -43,6 +43,7 @@ | LocalDataFlow.cs:315:15:315:20 | access to local variable sink73 | | LocalDataFlow.cs:316:15:316:20 | access to local variable sink74 | | LocalDataFlow.cs:342:15:342:21 | access to parameter tainted | +| LocalDataFlow.cs:387:15:387:15 | access to parameter s | | SSA.cs:9:15:9:22 | access to local variable ssaSink0 | | SSA.cs:25:15:25:22 | access to local variable ssaSink1 | | SSA.cs:43:15:43:22 | access to local variable ssaSink2 | diff --git a/csharp/ql/test/library-tests/dataflow/local/TaintTrackingStep.expected b/csharp/ql/test/library-tests/dataflow/local/TaintTrackingStep.expected index 87cd14bd25b..06251245a05 100644 --- a/csharp/ql/test/library-tests/dataflow/local/TaintTrackingStep.expected +++ b/csharp/ql/test/library-tests/dataflow/local/TaintTrackingStep.expected @@ -641,6 +641,9 @@ | LocalDataFlow.cs:381:17:381:29 | "not tainted" | LocalDataFlow.cs:381:13:381:13 | access to local variable x | | LocalDataFlow.cs:385:34:385:34 | SSA param(s) | LocalDataFlow.cs:387:15:387:15 | access to parameter s | | LocalDataFlow.cs:385:34:385:34 | s | LocalDataFlow.cs:385:34:385:34 | SSA param(s) | +| LocalDataFlow.cs:385:38:385:51 | "taint source" | LocalDataFlow.cs:385:38:385:51 | s = ... | +| LocalDataFlow.cs:385:38:385:51 | SSA param_default(s) | LocalDataFlow.cs:387:15:387:15 | access to parameter s | +| LocalDataFlow.cs:385:38:385:51 | s = ... | LocalDataFlow.cs:385:38:385:51 | SSA param_default(s) | | SSA.cs:3:14:3:16 | this | SSA.cs:3:14:3:16 | this access | | SSA.cs:5:17:5:17 | SSA entry def(this.S) | SSA.cs:67:9:67:14 | access to field S | | SSA.cs:5:17:5:17 | this | SSA.cs:67:9:67:12 | this access | diff --git a/csharp/ql/test/library-tests/dataflow/ssa/BaseSsaConsistency.ql b/csharp/ql/test/library-tests/dataflow/ssa/BaseSsaConsistency.ql index 4748f516114..d68e39fb396 100644 --- a/csharp/ql/test/library-tests/dataflow/ssa/BaseSsaConsistency.ql +++ b/csharp/ql/test/library-tests/dataflow/ssa/BaseSsaConsistency.ql @@ -12,7 +12,7 @@ where edef.getADefinition() = def and edef.getARead() = ar ) and - not exists(Ssa::ImplicitParameterDefinition edef | + not exists(Ssa::ParameterDefinition edef | edef.getParameter() = def.(AssignableDefinitions::ImplicitParameterDefinition).getParameter() and edef.getARead() = ar ) diff --git a/csharp/ql/test/library-tests/dataflow/ssa/DefAdjacentRead.expected b/csharp/ql/test/library-tests/dataflow/ssa/DefAdjacentRead.expected index a6833b789f7..0350c73ce25 100644 --- a/csharp/ql/test/library-tests/dataflow/ssa/DefAdjacentRead.expected +++ b/csharp/ql/test/library-tests/dataflow/ssa/DefAdjacentRead.expected @@ -62,8 +62,6 @@ | DefUse.cs:171:23:171:23 | a | DefUse.cs:171:23:180:9 | Action a = ... | DefUse.cs:181:9:181:9 | access to local variable a | | DefUse.cs:171:23:171:23 | a | DefUse.cs:186:9:190:9 | ... = ... | DefUse.cs:191:9:191:9 | access to local variable a | | DefaultParam.cs:3:20:3:20 | b | DefaultParam.cs:3:20:3:20 | b | DefaultParam.cs:5:16:5:16 | access to parameter b | -| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:5:20:5:20 | access to parameter s | -| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:5:24:5:24 | access to parameter i | | Example.cs:4:9:4:13 | Field | Example.cs:8:9:8:22 | ... = ... | Example.cs:9:13:9:22 | access to field Field | | Example.cs:6:23:6:23 | i | Example.cs:6:23:6:23 | i | Example.cs:8:22:8:22 | access to parameter i | | Example.cs:18:16:18:16 | p | Example.cs:18:16:18:16 | p | Example.cs:22:17:22:17 | access to parameter p | @@ -85,8 +83,6 @@ | Fields.cs:93:19:93:23 | Field | Fields.cs:102:9:102:28 | ... = ... | Fields.cs:104:16:104:25 | access to field Field | | Fields.cs:95:19:95:19 | f | Fields.cs:95:19:95:19 | f | Fields.cs:97:9:97:9 | access to parameter f | | Fields.cs:107:33:107:33 | f | Fields.cs:107:33:107:33 | f | Fields.cs:107:38:107:38 | access to parameter f | -| MultiImplementationA.cs:5:22:5:22 | x | MultiImplementationA.cs:5:22:5:22 | x | MultiImplementationA.cs:5:28:5:28 | access to parameter x | -| MultiImplementationA.cs:5:22:5:22 | x | MultiImplementationA.cs:5:22:5:22 | x | MultiImplementationB.cs:3:28:3:28 | access to parameter x | | OutRef.cs:5:9:5:13 | Field | OutRef.cs:13:28:13:32 | access to field Field | OutRef.cs:15:13:15:17 | access to field Field | | OutRef.cs:5:9:5:13 | Field | OutRef.cs:16:21:16:25 | access to field Field | OutRef.cs:17:13:17:17 | access to field Field | | OutRef.cs:5:9:5:13 | Field | OutRef.cs:16:32:16:36 | access to field Field | OutRef.cs:17:13:17:17 | access to field Field | diff --git a/csharp/ql/test/library-tests/dataflow/ssa/SSAPhi.expected b/csharp/ql/test/library-tests/dataflow/ssa/SSAPhi.expected index 1acf66efd96..7ace8cd316d 100644 --- a/csharp/ql/test/library-tests/dataflow/ssa/SSAPhi.expected +++ b/csharp/ql/test/library-tests/dataflow/ssa/SSAPhi.expected @@ -8,6 +8,10 @@ | DefUse.cs:79:13:79:14 | x1 | DefUse.cs:80:9:80:51 | SSA phi(x1) | DefUse.cs:80:30:80:31 | SSA def(x1) | | DefUse.cs:97:13:97:14 | x5 | DefUse.cs:98:9:102:9 | SSA phi(x5) | DefUse.cs:97:13:97:18 | SSA def(x5) | | DefUse.cs:97:13:97:14 | x5 | DefUse.cs:98:9:102:9 | SSA phi(x5) | DefUse.cs:101:13:101:23 | SSA def(x5) | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:42:3:42 | SSA phi(s) | DefaultParam.cs:3:30:3:30 | SSA param(s) | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:42:3:42 | SSA phi(s) | DefaultParam.cs:3:34:3:35 | SSA param_default(s) | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:4:5:6:5 | SSA phi(i) | DefaultParam.cs:3:42:3:42 | SSA param(i) | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:4:5:6:5 | SSA phi(i) | DefaultParam.cs:3:46:3:46 | SSA param_default(i) | | Example.cs:8:9:8:18 | this.Field | Example.cs:10:9:13:24 | SSA phi(this.Field) | Example.cs:11:13:11:30 | SSA def(this.Field) | | Example.cs:8:9:8:18 | this.Field | Example.cs:10:9:13:24 | SSA phi(this.Field) | Example.cs:12:14:13:24 | SSA phi(this.Field) | | Example.cs:8:9:8:18 | this.Field | Example.cs:12:14:13:24 | SSA phi(this.Field) | Example.cs:8:9:8:22 | SSA def(this.Field) | diff --git a/csharp/ql/test/library-tests/dataflow/ssa/SsaDef.expected b/csharp/ql/test/library-tests/dataflow/ssa/SsaDef.expected index 8f4af9a3aac..507ff8b2b6e 100644 --- a/csharp/ql/test/library-tests/dataflow/ssa/SsaDef.expected +++ b/csharp/ql/test/library-tests/dataflow/ssa/SsaDef.expected @@ -95,7 +95,11 @@ | DefUse.cs:188:13:188:18 | this.Field5 | DefUse.cs:188:13:188:22 | SSA def(this.Field5) | | DefaultParam.cs:3:20:3:20 | b | DefaultParam.cs:3:20:3:20 | SSA param(b) | | DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:30:3:30 | SSA param(s) | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:34:3:35 | SSA param_default(s) | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:42:3:42 | SSA phi(s) | | DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:3:42:3:42 | SSA param(i) | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:3:46:3:46 | SSA param_default(i) | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:4:5:6:5 | SSA phi(i) | | Example.cs:6:23:6:23 | i | Example.cs:6:23:6:23 | SSA param(i) | | Example.cs:8:9:8:18 | this.Field | Example.cs:8:9:8:22 | SSA def(this.Field) | | Example.cs:8:9:8:18 | this.Field | Example.cs:10:9:13:24 | SSA phi(this.Field) | diff --git a/csharp/ql/test/library-tests/dataflow/ssa/SsaDefElement.expected b/csharp/ql/test/library-tests/dataflow/ssa/SsaDefElement.expected index d0e2984050d..b6e2beaae69 100644 --- a/csharp/ql/test/library-tests/dataflow/ssa/SsaDefElement.expected +++ b/csharp/ql/test/library-tests/dataflow/ssa/SsaDefElement.expected @@ -90,7 +90,11 @@ | DefUse.cs:191:9:191:11 | SSA call def(this.Field5) | DefUse.cs:191:9:191:11 | delegate call | | DefaultParam.cs:3:20:3:20 | SSA param(b) | DefaultParam.cs:3:20:3:20 | b | | DefaultParam.cs:3:30:3:30 | SSA param(s) | DefaultParam.cs:3:30:3:30 | s | +| DefaultParam.cs:3:34:3:35 | SSA param_default(s) | DefaultParam.cs:3:34:3:35 | "" | | DefaultParam.cs:3:42:3:42 | SSA param(i) | DefaultParam.cs:3:42:3:42 | i | +| DefaultParam.cs:3:42:3:42 | SSA phi(s) | DefaultParam.cs:3:42:3:42 | i | +| DefaultParam.cs:3:46:3:46 | SSA param_default(i) | DefaultParam.cs:3:46:3:46 | 0 | +| DefaultParam.cs:4:5:6:5 | SSA phi(i) | DefaultParam.cs:4:5:6:5 | {...} | | Example.cs:6:23:6:23 | SSA param(i) | Example.cs:6:23:6:23 | i | | Example.cs:8:9:8:22 | SSA def(this.Field) | Example.cs:8:9:8:22 | ... = ... | | Example.cs:11:13:11:30 | SSA def(this.Field) | Example.cs:11:13:11:30 | ... = ... | @@ -148,8 +152,8 @@ | Fields.cs:114:9:114:22 | SSA call def(this.Field) | Fields.cs:114:9:114:22 | call to method SetField | | Fields.cs:114:9:114:22 | SSA call def(this.Field.Field) | Fields.cs:114:9:114:22 | call to method SetField | | Fields.cs:114:9:114:22 | SSA qualifier def(this.Field.Field.xs) | Fields.cs:114:9:114:22 | call to method SetField | -| MultiImplementationA.cs:5:22:5:22 | SSA param(x) | MultiImplementationA.cs:5:22:5:22 | x | -| MultiImplementationB.cs:3:22:3:22 | SSA param(x) | MultiImplementationA.cs:5:22:5:22 | x | +| MultiImplementationA.cs:5:22:5:22 | SSA param(x) | MultiImplementationA.cs:5:16:5:16 | M | +| MultiImplementationB.cs:3:22:3:22 | SSA param(x) | MultiImplementationA.cs:5:16:5:16 | M | | OutRef.cs:7:10:7:10 | SSA entry def(this.Field) | OutRef.cs:7:10:7:10 | M | | OutRef.cs:9:13:9:17 | SSA def(j) | OutRef.cs:9:13:9:17 | Int32 j = ... | | OutRef.cs:10:25:10:25 | SSA def(i) | OutRef.cs:10:9:10:33 | call to method OutRefM | diff --git a/csharp/ql/test/library-tests/dataflow/ssa/SsaExplicitDef.expected b/csharp/ql/test/library-tests/dataflow/ssa/SsaExplicitDef.expected index 8582dd1cf6e..9a2e5c49b15 100644 --- a/csharp/ql/test/library-tests/dataflow/ssa/SsaExplicitDef.expected +++ b/csharp/ql/test/library-tests/dataflow/ssa/SsaExplicitDef.expected @@ -3,10 +3,18 @@ | Capture.cs:19:20:19:20 | b | Capture.cs:19:20:23:13 | SSA def(b) | Capture.cs:19:20:23:13 | Action b = ... | | Capture.cs:30:16:30:16 | c | Capture.cs:30:16:30:35 | SSA def(c) | Capture.cs:30:16:30:35 | Action c = ... | | Capture.cs:52:16:52:16 | b | Capture.cs:52:16:52:43 | SSA def(b) | Capture.cs:52:16:52:43 | Action b = ... | +| Capture.cs:57:57:57:63 | strings | Capture.cs:57:57:57:63 | SSA param(strings) | Capture.cs:57:57:57:63 | strings | | Capture.cs:60:27:60:27 | e | Capture.cs:60:27:60:38 | SSA def(e) | Capture.cs:60:27:60:38 | Func e = ... | +| Capture.cs:65:45:65:51 | strings | Capture.cs:65:45:65:51 | SSA param(strings) | Capture.cs:65:45:65:51 | strings | +| Capture.cs:68:32:68:32 | s | Capture.cs:68:32:68:32 | SSA param(s) | Capture.cs:68:32:68:32 | s | +| Capture.cs:69:25:69:25 | s | Capture.cs:69:25:69:25 | SSA param(s) | Capture.cs:69:25:69:25 | s | +| Capture.cs:73:67:73:73 | strings | Capture.cs:73:67:73:73 | SSA param(strings) | Capture.cs:73:67:73:73 | strings | | Capture.cs:76:63:76:63 | e | Capture.cs:76:63:76:81 | SSA def(e) | Capture.cs:76:63:76:81 | Expression> e = ... | +| Capture.cs:81:28:81:28 | i | Capture.cs:81:28:81:28 | SSA param(i) | Capture.cs:81:28:81:28 | i | | Capture.cs:81:28:81:28 | i | Capture.cs:81:34:81:36 | SSA def(i) | Capture.cs:81:34:81:36 | ...++ | +| Capture.cs:83:65:83:71 | strings | Capture.cs:83:65:83:71 | SSA param(strings) | Capture.cs:83:65:83:71 | strings | | Capture.cs:86:64:86:64 | e | Capture.cs:86:64:86:73 | SSA def(e) | Capture.cs:86:64:86:73 | Expression> e = ... | +| Capture.cs:92:18:92:18 | d | Capture.cs:92:18:92:18 | SSA param(d) | Capture.cs:92:18:92:18 | d | | Capture.cs:98:17:98:17 | x | Capture.cs:98:17:98:21 | SSA def(x) | Capture.cs:98:17:98:21 | Int32 x = ... | | Capture.cs:117:17:117:17 | x | Capture.cs:117:17:117:21 | SSA def(x) | Capture.cs:117:17:117:21 | Int32 x = ... | | Capture.cs:198:28:198:29 | eh | Capture.cs:198:28:198:44 | SSA def(eh) | Capture.cs:198:28:198:44 | MyEventHandler eh = ... | @@ -14,13 +22,18 @@ | Capture.cs:210:24:210:24 | p | Capture.cs:210:24:210:59 | SSA def(p) | Capture.cs:210:24:210:59 | Process p = ... | | Capture.cs:212:30:212:35 | exited | Capture.cs:212:30:212:71 | SSA def(exited) | Capture.cs:212:30:212:71 | EventHandler exited = ... | | Capture.cs:248:36:248:36 | j | Capture.cs:251:13:251:17 | SSA def(j) | Capture.cs:251:13:251:17 | ... = ... | +| Consistency.cs:7:25:7:25 | b | Consistency.cs:7:25:7:25 | SSA param(b) | Consistency.cs:7:25:7:25 | b | | Consistency.cs:15:17:15:17 | i | Consistency.cs:15:17:15:21 | SSA def(i) | Consistency.cs:15:17:15:21 | Int32 i = ... | | Consistency.cs:25:29:25:29 | c | Consistency.cs:25:29:25:29 | SSA def(c) | Consistency.cs:25:29:25:29 | Consistency c | | Consistency.cs:30:30:30:30 | c | Consistency.cs:32:9:32:29 | SSA def(c) | Consistency.cs:32:9:32:29 | ... = ... | | Consistency.cs:44:11:44:11 | s | Consistency.cs:44:11:44:11 | SSA def(s) | Consistency.cs:44:11:44:11 | S s | +| Consistency.cs:49:30:49:30 | a | Consistency.cs:49:30:49:30 | SSA param(a) | Consistency.cs:49:30:49:30 | a | +| Consistency.cs:49:37:49:37 | i | Consistency.cs:49:37:49:37 | SSA param(i) | Consistency.cs:49:37:49:37 | i | +| Consistency.cs:51:20:51:20 | a | Consistency.cs:51:20:51:20 | SSA param(a) | Consistency.cs:51:20:51:20 | a | | Consistency.cs:56:17:56:17 | k | Consistency.cs:56:17:56:40 | SSA def(k) | Consistency.cs:56:17:56:40 | Int32 k = ... | | Consistency.cs:56:17:56:17 | k | Consistency.cs:57:9:57:13 | SSA def(k) | Consistency.cs:57:9:57:13 | ... = ... | | Consistency.cs:56:17:56:17 | k | Consistency.cs:58:9:58:13 | SSA def(k) | Consistency.cs:58:9:58:13 | ... = ... | +| DefUse.cs:3:26:3:26 | w | DefUse.cs:3:26:3:26 | SSA param(w) | DefUse.cs:3:26:3:26 | w | | DefUse.cs:3:26:3:26 | w | DefUse.cs:19:13:19:18 | SSA def(w) | DefUse.cs:19:13:19:18 | ... = ... | | DefUse.cs:3:26:3:26 | w | DefUse.cs:29:13:29:18 | SSA def(w) | DefUse.cs:29:13:29:18 | ... = ... | | DefUse.cs:5:13:5:13 | x | DefUse.cs:5:13:5:17 | SSA def(x) | DefUse.cs:5:13:5:17 | Int32 x = ... | @@ -50,17 +63,29 @@ | DefUse.cs:97:13:97:14 | x5 | DefUse.cs:104:9:104:15 | SSA def(x5) | DefUse.cs:104:9:104:15 | ... += ... | | DefUse.cs:114:42:114:42 | i | DefUse.cs:114:47:114:52 | SSA def(i) | DefUse.cs:114:47:114:52 | ... = ... | | DefUse.cs:116:42:116:42 | i | DefUse.cs:116:47:116:51 | SSA def(i) | DefUse.cs:116:47:116:51 | ... = ... | +| DefUse.cs:118:45:118:45 | i | DefUse.cs:118:45:118:45 | SSA param(i) | DefUse.cs:118:45:118:45 | i | | DefUse.cs:118:45:118:45 | i | DefUse.cs:118:68:118:72 | SSA def(i) | DefUse.cs:118:68:118:72 | ... = ... | | DefUse.cs:118:56:118:56 | j | DefUse.cs:118:61:118:65 | SSA def(j) | DefUse.cs:118:61:118:65 | ... = ... | +| DefUse.cs:128:19:128:19 | i | DefUse.cs:128:19:128:19 | SSA param(i) | DefUse.cs:128:19:128:19 | i | +| DefUse.cs:134:22:134:22 | d | DefUse.cs:134:22:134:22 | SSA param(d) | DefUse.cs:134:22:134:22 | d | +| DefUse.cs:142:68:142:69 | ie | DefUse.cs:142:68:142:69 | SSA param(ie) | DefUse.cs:142:68:142:69 | ie | | DefUse.cs:144:22:144:22 | x | DefUse.cs:144:22:144:22 | SSA def(x) | DefUse.cs:144:22:144:22 | String x | | DefUse.cs:155:9:155:14 | this.Field4 | DefUse.cs:155:9:155:18 | SSA def(this.Field4) | DefUse.cs:155:9:155:18 | ... = ... | | DefUse.cs:171:23:171:23 | a | DefUse.cs:171:23:180:9 | SSA def(a) | DefUse.cs:171:23:180:9 | Action a = ... | | DefUse.cs:171:23:171:23 | a | DefUse.cs:186:9:190:9 | SSA def(a) | DefUse.cs:186:9:190:9 | ... = ... | | DefUse.cs:184:9:184:14 | this.Field5 | DefUse.cs:184:9:184:18 | SSA def(this.Field5) | DefUse.cs:184:9:184:18 | ... = ... | | DefUse.cs:188:13:188:18 | this.Field5 | DefUse.cs:188:13:188:22 | SSA def(this.Field5) | DefUse.cs:188:13:188:22 | ... = ... | +| DefaultParam.cs:3:20:3:20 | b | DefaultParam.cs:3:20:3:20 | SSA param(b) | DefaultParam.cs:3:20:3:20 | b | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:30:3:30 | SSA param(s) | DefaultParam.cs:3:30:3:30 | s | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:34:3:35 | SSA param_default(s) | DefaultParam.cs:3:34:3:35 | s = ... | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:3:42:3:42 | SSA param(i) | DefaultParam.cs:3:42:3:42 | i | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:3:46:3:46 | SSA param_default(i) | DefaultParam.cs:3:46:3:46 | i = ... | +| Example.cs:6:23:6:23 | i | Example.cs:6:23:6:23 | SSA param(i) | Example.cs:6:23:6:23 | i | | Example.cs:8:9:8:18 | this.Field | Example.cs:8:9:8:22 | SSA def(this.Field) | Example.cs:8:9:8:22 | ... = ... | | Example.cs:8:9:8:18 | this.Field | Example.cs:11:13:11:30 | SSA def(this.Field) | Example.cs:11:13:11:30 | ... = ... | +| Example.cs:18:16:18:16 | p | Example.cs:18:16:18:16 | SSA param(p) | Example.cs:18:16:18:16 | p | | Example.cs:18:16:18:16 | p | Example.cs:23:13:23:17 | SSA def(p) | Example.cs:23:13:23:17 | ... = ... | +| Example.cs:18:24:18:24 | b | Example.cs:18:24:18:24 | SSA param(b) | Example.cs:18:24:18:24 | b | | Fields.cs:18:15:18:15 | x | Fields.cs:20:9:20:14 | SSA def(x) | Fields.cs:20:9:20:14 | ... = ... | | Fields.cs:18:19:18:20 | this.xs | Fields.cs:24:9:24:23 | SSA def(this.xs) | Fields.cs:24:9:24:23 | ... = ... | | Fields.cs:30:13:30:13 | f | Fields.cs:30:13:30:28 | SSA def(f) | Fields.cs:30:13:30:28 | Fields f = ... | @@ -76,8 +101,10 @@ | Fields.cs:80:9:80:12 | f.xs | Fields.cs:88:9:88:25 | SSA def(f.xs) | Fields.cs:88:9:88:25 | ... = ... | | Fields.cs:82:9:82:15 | this.xs | Fields.cs:85:9:85:22 | SSA def(this.xs) | Fields.cs:85:9:85:22 | ... = ... | | Fields.cs:82:9:82:15 | this.xs | Fields.cs:87:9:87:22 | SSA def(this.xs) | Fields.cs:87:9:87:22 | ... = ... | +| Fields.cs:95:19:95:19 | f | Fields.cs:95:19:95:19 | SSA param(f) | Fields.cs:95:19:95:19 | f | | Fields.cs:97:9:97:15 | f.Field | Fields.cs:97:9:97:30 | SSA def(f.Field) | Fields.cs:97:9:97:30 | ... = ... | | Fields.cs:102:9:102:18 | this.Field | Fields.cs:102:9:102:28 | SSA def(this.Field) | Fields.cs:102:9:102:28 | ... = ... | +| Fields.cs:107:33:107:33 | f | Fields.cs:107:33:107:33 | SSA param(f) | Fields.cs:107:33:107:33 | f | | OutRef.cs:9:13:9:13 | j | OutRef.cs:9:13:9:17 | SSA def(j) | OutRef.cs:9:13:9:17 | Int32 j = ... | | OutRef.cs:9:13:9:13 | j | OutRef.cs:10:32:10:32 | SSA def(j) | OutRef.cs:10:32:10:32 | access to local variable j | | OutRef.cs:9:13:9:13 | j | OutRef.cs:22:22:22:22 | SSA def(j) | OutRef.cs:22:22:22:22 | access to local variable j | @@ -91,8 +118,12 @@ | OutRef.cs:18:13:18:13 | t | OutRef.cs:18:13:18:28 | SSA def(t) | OutRef.cs:18:13:18:28 | OutRef t = ... | | OutRef.cs:19:32:19:38 | t.Field | OutRef.cs:19:32:19:38 | SSA def(t.Field) | OutRef.cs:19:32:19:38 | access to field Field | | OutRef.cs:28:26:28:26 | i | OutRef.cs:30:9:30:13 | SSA def(i) | OutRef.cs:30:9:30:13 | ... = ... | +| OutRef.cs:28:37:28:37 | j | OutRef.cs:28:37:28:37 | SSA param(j) | OutRef.cs:28:37:28:37 | j | | OutRef.cs:28:37:28:37 | j | OutRef.cs:31:9:31:13 | SSA def(j) | OutRef.cs:31:9:31:13 | ... = ... | | OutRef.cs:34:27:34:27 | i | OutRef.cs:36:9:36:13 | SSA def(i) | OutRef.cs:36:9:36:13 | ... = ... | +| OutRef.cs:34:38:34:38 | j | OutRef.cs:34:38:34:38 | SSA param(j) | OutRef.cs:34:38:34:38 | j | +| OutRef.cs:39:24:39:24 | b | OutRef.cs:39:24:39:24 | SSA param(b) | OutRef.cs:39:24:39:24 | b | +| OutRef.cs:39:35:39:35 | j | OutRef.cs:39:35:39:35 | SSA param(j) | OutRef.cs:39:35:39:35 | j | | OutRef.cs:39:35:39:35 | j | OutRef.cs:42:13:42:17 | SSA def(j) | OutRef.cs:42:13:42:17 | ... = ... | | Patterns.cs:7:16:7:16 | o | Patterns.cs:7:16:7:23 | SSA def(o) | Patterns.cs:7:16:7:23 | Object o = ... | | Patterns.cs:8:22:8:23 | i1 | Patterns.cs:8:18:8:23 | SSA def(i1) | Patterns.cs:8:18:8:23 | Int32 i1 | @@ -107,6 +138,7 @@ | Properties.cs:31:19:31:22 | f.xs | Properties.cs:45:9:45:25 | SSA def(f.xs) | Properties.cs:45:9:45:25 | ... = ... | | Properties.cs:32:15:32:15 | z | Properties.cs:47:9:47:14 | SSA def(z) | Properties.cs:47:9:47:14 | ... = ... | | Properties.cs:32:19:32:20 | this.xs | Properties.cs:42:9:42:23 | SSA def(this.xs) | Properties.cs:42:9:42:23 | ... = ... | +| Properties.cs:61:23:61:23 | i | Properties.cs:61:23:61:23 | SSA param(i) | Properties.cs:61:23:61:23 | i | | Properties.cs:61:23:61:23 | i | Properties.cs:63:16:63:18 | SSA def(i) | Properties.cs:63:16:63:18 | ...-- | | Properties.cs:73:13:73:13 | f | Properties.cs:73:13:73:32 | SSA def(f) | Properties.cs:73:13:73:32 | Properties f = ... | | Properties.cs:74:23:74:23 | a | Properties.cs:74:23:74:54 | SSA def(a) | Properties.cs:74:23:74:54 | Action a = ... | @@ -116,8 +148,11 @@ | Properties.cs:76:9:76:12 | f.xs | Properties.cs:84:9:84:25 | SSA def(f.xs) | Properties.cs:84:9:84:25 | ... = ... | | Properties.cs:78:9:78:15 | this.xs | Properties.cs:81:9:81:22 | SSA def(this.xs) | Properties.cs:81:9:81:22 | ... = ... | | Properties.cs:78:9:78:15 | this.xs | Properties.cs:83:9:83:22 | SSA def(this.xs) | Properties.cs:83:9:83:22 | ... = ... | +| Properties.cs:106:37:106:37 | p | Properties.cs:106:37:106:37 | SSA param(p) | Properties.cs:106:37:106:37 | p | +| Test.cs:5:15:5:20 | param1 | Test.cs:5:15:5:20 | SSA param(param1) | Test.cs:5:15:5:20 | param1 | | Test.cs:5:15:5:20 | param1 | Test.cs:27:17:27:24 | SSA def(param1) | Test.cs:27:17:27:24 | ...++ | | Test.cs:5:15:5:20 | param1 | Test.cs:41:13:41:23 | SSA def(param1) | Test.cs:41:13:41:23 | ... += ... | +| Test.cs:5:67:5:72 | param2 | Test.cs:5:67:5:72 | SSA param(param2) | Test.cs:5:67:5:72 | param2 | | Test.cs:7:9:7:13 | this.field | Test.cs:7:9:7:17 | SSA def(this.field) | Test.cs:7:9:7:17 | ... = ... | | Test.cs:7:9:7:13 | this.field | Test.cs:21:13:21:22 | SSA def(this.field) | Test.cs:21:13:21:22 | ... = ... | | Test.cs:8:13:8:13 | x | Test.cs:8:13:8:17 | SSA def(x) | Test.cs:8:13:8:17 | Int32 x = ... | @@ -133,10 +168,18 @@ | Test.cs:34:18:34:18 | i | Test.cs:34:18:34:22 | SSA def(i) | Test.cs:34:18:34:22 | Int32 i = ... | | Test.cs:34:18:34:18 | i | Test.cs:34:33:34:35 | SSA def(i) | Test.cs:34:33:34:35 | ...++ | | Test.cs:39:22:39:22 | w | Test.cs:39:22:39:22 | SSA def(w) | Test.cs:39:22:39:22 | Int32 w | +| Test.cs:46:16:46:18 | in | Test.cs:46:16:46:18 | SSA param(in) | Test.cs:46:16:46:18 | in | | Test.cs:46:29:46:32 | out | Test.cs:50:13:50:20 | SSA def(out) | Test.cs:50:13:50:20 | ... = ... | | Test.cs:46:29:46:32 | out | Test.cs:54:13:54:20 | SSA def(out) | Test.cs:54:13:54:20 | ... = ... | | Test.cs:56:13:56:17 | this.field | Test.cs:57:9:57:17 | SSA def(this.field) | Test.cs:57:9:57:17 | ... = ... | +| Test.cs:62:16:62:16 | x | Test.cs:62:16:62:16 | SSA param(x) | Test.cs:62:16:62:16 | x | | Test.cs:68:45:68:45 | e | Test.cs:68:45:68:45 | SSA def(e) | Test.cs:68:45:68:45 | DivideByZeroException e | +| Test.cs:76:24:76:25 | b1 | Test.cs:76:24:76:25 | SSA param(b1) | Test.cs:76:24:76:25 | b1 | +| Test.cs:76:33:76:34 | b2 | Test.cs:76:33:76:34 | SSA param(b2) | Test.cs:76:33:76:34 | b2 | +| Test.cs:76:42:76:43 | b3 | Test.cs:76:42:76:43 | SSA param(b3) | Test.cs:76:42:76:43 | b3 | +| Test.cs:76:51:76:52 | b4 | Test.cs:76:51:76:52 | SSA param(b4) | Test.cs:76:51:76:52 | b4 | +| Test.cs:76:60:76:61 | b5 | Test.cs:76:60:76:61 | SSA param(b5) | Test.cs:76:60:76:61 | b5 | +| Test.cs:76:69:76:70 | b6 | Test.cs:76:69:76:70 | SSA param(b6) | Test.cs:76:69:76:70 | b6 | | Test.cs:78:13:78:13 | x | Test.cs:78:13:78:17 | SSA def(x) | Test.cs:78:13:78:17 | Int32 x = ... | | Test.cs:78:13:78:13 | x | Test.cs:108:13:108:17 | SSA def(x) | Test.cs:108:13:108:17 | ... = ... | | Tuples.cs:10:14:10:14 | x | Tuples.cs:10:9:10:54 | SSA def(x) | Tuples.cs:10:9:10:54 | ... = ... | diff --git a/csharp/ql/test/library-tests/dataflow/ssa/SsaImplicitParameterDef.ql b/csharp/ql/test/library-tests/dataflow/ssa/SsaImplicitParameterDef.ql index 8608b90746e..253fdea1ffa 100644 --- a/csharp/ql/test/library-tests/dataflow/ssa/SsaImplicitParameterDef.ql +++ b/csharp/ql/test/library-tests/dataflow/ssa/SsaImplicitParameterDef.ql @@ -1,5 +1,5 @@ import csharp -from Ssa::SourceVariable v, Ssa::ImplicitParameterDefinition def +from Ssa::SourceVariable v, Ssa::ParameterDefinition def where v = def.getSourceVariable() select v, def, def.getParameter() diff --git a/csharp/ql/test/library-tests/dataflow/ssa/SsaRead.expected b/csharp/ql/test/library-tests/dataflow/ssa/SsaRead.expected index 96ae63b34fb..88ed6233672 100644 --- a/csharp/ql/test/library-tests/dataflow/ssa/SsaRead.expected +++ b/csharp/ql/test/library-tests/dataflow/ssa/SsaRead.expected @@ -100,8 +100,8 @@ | DefUse.cs:184:9:184:14 | this.Field5 | DefUse.cs:191:9:191:11 | SSA call def(this.Field5) | DefUse.cs:192:13:192:18 | access to field Field5 | | DefUse.cs:188:13:188:18 | this.Field5 | DefUse.cs:188:13:188:22 | SSA def(this.Field5) | DefUse.cs:189:17:189:22 | access to field Field5 | | DefaultParam.cs:3:20:3:20 | b | DefaultParam.cs:3:20:3:20 | SSA param(b) | DefaultParam.cs:5:16:5:16 | access to parameter b | -| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:30:3:30 | SSA param(s) | DefaultParam.cs:5:20:5:20 | access to parameter s | -| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:3:42:3:42 | SSA param(i) | DefaultParam.cs:5:24:5:24 | access to parameter i | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:42:3:42 | SSA phi(s) | DefaultParam.cs:5:20:5:20 | access to parameter s | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:4:5:6:5 | SSA phi(i) | DefaultParam.cs:5:24:5:24 | access to parameter i | | Example.cs:6:23:6:23 | i | Example.cs:6:23:6:23 | SSA param(i) | Example.cs:8:22:8:22 | access to parameter i | | Example.cs:6:23:6:23 | i | Example.cs:6:23:6:23 | SSA param(i) | Example.cs:10:13:10:13 | access to parameter i | | Example.cs:6:23:6:23 | i | Example.cs:6:23:6:23 | SSA param(i) | Example.cs:11:26:11:26 | access to parameter i | diff --git a/csharp/ql/test/library-tests/dataflow/ssa/SsaUltimateDef.expected b/csharp/ql/test/library-tests/dataflow/ssa/SsaUltimateDef.expected index c3ccef11a44..00bacccf157 100644 --- a/csharp/ql/test/library-tests/dataflow/ssa/SsaUltimateDef.expected +++ b/csharp/ql/test/library-tests/dataflow/ssa/SsaUltimateDef.expected @@ -101,7 +101,13 @@ | DefUse.cs:188:13:188:18 | this.Field5 | DefUse.cs:188:13:188:22 | SSA def(this.Field5) | DefUse.cs:188:13:188:22 | SSA def(this.Field5) | | DefaultParam.cs:3:20:3:20 | b | DefaultParam.cs:3:20:3:20 | SSA param(b) | DefaultParam.cs:3:20:3:20 | SSA param(b) | | DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:30:3:30 | SSA param(s) | DefaultParam.cs:3:30:3:30 | SSA param(s) | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:34:3:35 | SSA param_default(s) | DefaultParam.cs:3:34:3:35 | SSA param_default(s) | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:42:3:42 | SSA phi(s) | DefaultParam.cs:3:30:3:30 | SSA param(s) | +| DefaultParam.cs:3:30:3:30 | s | DefaultParam.cs:3:42:3:42 | SSA phi(s) | DefaultParam.cs:3:34:3:35 | SSA param_default(s) | | DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:3:42:3:42 | SSA param(i) | DefaultParam.cs:3:42:3:42 | SSA param(i) | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:3:46:3:46 | SSA param_default(i) | DefaultParam.cs:3:46:3:46 | SSA param_default(i) | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:4:5:6:5 | SSA phi(i) | DefaultParam.cs:3:42:3:42 | SSA param(i) | +| DefaultParam.cs:3:42:3:42 | i | DefaultParam.cs:4:5:6:5 | SSA phi(i) | DefaultParam.cs:3:46:3:46 | SSA param_default(i) | | Example.cs:6:23:6:23 | i | Example.cs:6:23:6:23 | SSA param(i) | Example.cs:6:23:6:23 | SSA param(i) | | Example.cs:8:9:8:18 | this.Field | Example.cs:8:9:8:22 | SSA def(this.Field) | Example.cs:8:9:8:22 | SSA def(this.Field) | | Example.cs:8:9:8:18 | this.Field | Example.cs:10:9:13:24 | SSA phi(this.Field) | Example.cs:8:9:8:22 | SSA def(this.Field) |