mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Merge pull request #15736 from michaelnebel/csharp/disconnectfromdotnet
C#: Deprecate dotnet and CIL in QL.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import csharp
|
||||
import cil
|
||||
private import semmle.code.csharp.controlflow.internal.ControlFlowGraphImpl as ControlFlowGraphImpl
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowImplSpecific
|
||||
private import semmle.code.csharp.dataflow.internal.TaintTrackingImplSpecific
|
||||
@@ -31,11 +30,6 @@ private module Input implements InputSig<CsharpDataFlow> {
|
||||
n instanceof FlowInsensitiveFieldNode
|
||||
}
|
||||
|
||||
predicate missingLocationExclude(Node n) {
|
||||
// Some CIL methods are missing locations
|
||||
n.asParameter() instanceof CIL::Parameter
|
||||
}
|
||||
|
||||
predicate postWithInFlowExclude(Node n) {
|
||||
n instanceof FlowSummaryNode
|
||||
or
|
||||
@@ -48,8 +42,6 @@ private module Input implements InputSig<CsharpDataFlow> {
|
||||
not exists(LocalFlow::getAPostUpdateNodeForArg(n.getControlFlowNode()))
|
||||
or
|
||||
n instanceof ParamsArgumentNode
|
||||
or
|
||||
n.asExpr() instanceof CIL::Expr
|
||||
}
|
||||
|
||||
predicate postHasUniquePreExclude(PostUpdateNode n) {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: breaking
|
||||
---
|
||||
* The QL library C# classes no longer extend their corresponding `DotNet` classes. Furthermore, CIL related data flow functionality has been deleted and all `DotNet` and `CIL` related classes have been deprecated. This effectively means that it no longer has any effect to enable CIL extraction.
|
||||
@@ -2,4 +2,4 @@
|
||||
* The default QL library for modeling .NET definitions for both C# and CIL code.
|
||||
*/
|
||||
|
||||
import semmle.code.dotnet.DotNet as DotNet
|
||||
deprecated import semmle.code.dotnet.DotNet as DotNet
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
private import CIL
|
||||
|
||||
/** An instruction that accesses a variable. */
|
||||
class Access extends Instruction, @cil_access {
|
||||
deprecated class Access extends Instruction, @cil_access {
|
||||
/** Gets the declaration referenced by this instruction. */
|
||||
Variable getTarget() { cil_access(this, result) }
|
||||
}
|
||||
@@ -16,59 +16,59 @@ class Access extends Instruction, @cil_access {
|
||||
* An instruction that accesses a variable.
|
||||
* This class is provided for consistency with the C# data model.
|
||||
*/
|
||||
class VariableAccess extends Access, @cil_access { }
|
||||
deprecated class VariableAccess extends Access, @cil_access { }
|
||||
|
||||
/** An instruction that reads a variable. */
|
||||
class ReadAccess extends VariableAccess, Expr, @cil_read_access {
|
||||
deprecated class ReadAccess extends VariableAccess, Expr, @cil_read_access {
|
||||
override Type getType() { result = this.getTarget().getType() }
|
||||
}
|
||||
|
||||
/** An instruction yielding an address. */
|
||||
class ReadRef extends Expr, @cil_read_ref { }
|
||||
deprecated class ReadRef extends Expr, @cil_read_ref { }
|
||||
|
||||
/** An instruction that reads the address of a variable. */
|
||||
class ReadRefAccess extends ReadAccess, ReadRef { }
|
||||
deprecated class ReadRefAccess extends ReadAccess, ReadRef { }
|
||||
|
||||
/** An instruction that writes a variable. */
|
||||
class WriteAccess extends VariableAccess, @cil_write_access {
|
||||
deprecated class WriteAccess extends VariableAccess, @cil_write_access {
|
||||
/** Gets the expression whose value is used in this variable write. */
|
||||
Expr getExpr() { none() }
|
||||
}
|
||||
|
||||
/** An instruction that accesses a parameter. */
|
||||
class ParameterAccess extends StackVariableAccess, @cil_arg_access {
|
||||
deprecated class ParameterAccess extends StackVariableAccess, @cil_arg_access {
|
||||
override MethodParameter getTarget() { result = StackVariableAccess.super.getTarget() }
|
||||
}
|
||||
|
||||
/** An instruction that reads a parameter. */
|
||||
class ParameterReadAccess extends ParameterAccess, ReadAccess {
|
||||
deprecated class ParameterReadAccess extends ParameterAccess, ReadAccess {
|
||||
override int getPopCount() { result = 0 }
|
||||
}
|
||||
|
||||
/** An instruction that writes to a parameter. */
|
||||
class ParameterWriteAccess extends ParameterAccess, WriteAccess {
|
||||
deprecated class ParameterWriteAccess extends ParameterAccess, WriteAccess {
|
||||
override int getPopCount() { result = 1 }
|
||||
|
||||
override Expr getExpr() { result = this.getOperand(0) }
|
||||
}
|
||||
|
||||
/** An access to the `this` parameter. */
|
||||
class ThisAccess extends ParameterReadAccess {
|
||||
deprecated class ThisAccess extends ParameterReadAccess {
|
||||
ThisAccess() { this.getTarget() instanceof ThisParameter }
|
||||
}
|
||||
|
||||
/** An instruction that accesses a stack variable. */
|
||||
class StackVariableAccess extends VariableAccess, @cil_stack_access {
|
||||
deprecated class StackVariableAccess extends VariableAccess, @cil_stack_access {
|
||||
override StackVariable getTarget() { result = VariableAccess.super.getTarget() }
|
||||
}
|
||||
|
||||
/** An instruction that accesses a local variable. */
|
||||
class LocalVariableAccess extends StackVariableAccess, @cil_local_access {
|
||||
deprecated class LocalVariableAccess extends StackVariableAccess, @cil_local_access {
|
||||
override LocalVariable getTarget() { result = StackVariableAccess.super.getTarget() }
|
||||
}
|
||||
|
||||
/** An instruction that writes to a local variable. */
|
||||
class LocalVariableWriteAccess extends LocalVariableAccess, WriteAccess {
|
||||
deprecated class LocalVariableWriteAccess extends LocalVariableAccess, WriteAccess {
|
||||
override int getPopCount() { result = 1 }
|
||||
|
||||
override Expr getExpr() { result = this.getOperand(0) }
|
||||
@@ -77,12 +77,12 @@ class LocalVariableWriteAccess extends LocalVariableAccess, WriteAccess {
|
||||
}
|
||||
|
||||
/** An instruction that reads a local variable. */
|
||||
class LocalVariableReadAccess extends LocalVariableAccess, ReadAccess {
|
||||
deprecated class LocalVariableReadAccess extends LocalVariableAccess, ReadAccess {
|
||||
override int getPopCount() { result = 0 }
|
||||
}
|
||||
|
||||
/** An instruction that accesses a field. */
|
||||
class FieldAccess extends VariableAccess, @cil_field_access {
|
||||
deprecated class FieldAccess extends VariableAccess, @cil_field_access {
|
||||
override Field getTarget() { result = VariableAccess.super.getTarget() }
|
||||
|
||||
override string getExtra() { result = this.getTarget().getName() }
|
||||
@@ -92,7 +92,7 @@ class FieldAccess extends VariableAccess, @cil_field_access {
|
||||
}
|
||||
|
||||
/** An instruction that reads a field. */
|
||||
abstract class FieldReadAccess extends FieldAccess, ReadAccess { }
|
||||
abstract deprecated class FieldReadAccess extends FieldAccess, ReadAccess { }
|
||||
|
||||
/** An instruction that writes a field. */
|
||||
abstract class FieldWriteAccess extends FieldAccess, WriteAccess { }
|
||||
abstract deprecated class FieldWriteAccess extends FieldAccess, WriteAccess { }
|
||||
|
||||
@@ -4,7 +4,7 @@ private import CIL
|
||||
private import semmle.code.csharp.Location as CS
|
||||
|
||||
/** An attribute to a declaration, such as a method, field, type or parameter. */
|
||||
class Attribute extends Element, @cil_attribute {
|
||||
deprecated class Attribute extends Element, @cil_attribute {
|
||||
/** Gets the declaration this attribute is attached to. */
|
||||
Declaration getDeclaration() { cil_attribute(this, result, _) }
|
||||
|
||||
@@ -29,7 +29,7 @@ class Attribute extends Element, @cil_attribute {
|
||||
}
|
||||
|
||||
/** A generic attribute to a declaration. */
|
||||
class GenericAttribute extends Attribute {
|
||||
deprecated class GenericAttribute extends Attribute {
|
||||
private ConstructedType type;
|
||||
|
||||
GenericAttribute() { type = this.getType() }
|
||||
|
||||
@@ -8,7 +8,7 @@ private import CIL
|
||||
* A basic block, that is, a maximal straight-line sequence of control flow nodes
|
||||
* without branches or joins.
|
||||
*/
|
||||
class BasicBlock extends Cached::TBasicBlockStart {
|
||||
deprecated class BasicBlock extends Cached::TBasicBlockStart {
|
||||
/** Gets an immediate successor of this basic block, if any. */
|
||||
BasicBlock getASuccessor() { result.getFirstNode() = this.getLastNode().getASuccessor() }
|
||||
|
||||
@@ -249,7 +249,7 @@ class BasicBlock extends Cached::TBasicBlockStart {
|
||||
* Internal implementation details.
|
||||
*/
|
||||
cached
|
||||
private module Cached {
|
||||
deprecated private module Cached {
|
||||
/** Internal representation of basic blocks. */
|
||||
cached
|
||||
newtype TBasicBlock = TBasicBlockStart(ControlFlowNode cfn) { startsBB(cfn) }
|
||||
@@ -287,49 +287,54 @@ private module Cached {
|
||||
* Holds if the first node of basic block `succ` is a control flow
|
||||
* successor of the last node of basic block `pred`.
|
||||
*/
|
||||
private predicate succBB(BasicBlock pred, BasicBlock succ) { succ = pred.getASuccessor() }
|
||||
deprecated private predicate succBB(BasicBlock pred, BasicBlock succ) {
|
||||
succ = pred.getASuccessor()
|
||||
}
|
||||
|
||||
/** Holds if `dom` is an immediate dominator of `bb`. */
|
||||
predicate bbIDominates(BasicBlock dom, BasicBlock bb) = idominance(entryBB/1, succBB/2)(_, dom, bb)
|
||||
deprecated predicate bbIDominates(BasicBlock dom, BasicBlock bb) =
|
||||
idominance(entryBB/1, succBB/2)(_, dom, bb)
|
||||
|
||||
/** Holds if `pred` is a basic block predecessor of `succ`. */
|
||||
private predicate predBB(BasicBlock succ, BasicBlock pred) { succBB(pred, succ) }
|
||||
deprecated private predicate predBB(BasicBlock succ, BasicBlock pred) { succBB(pred, succ) }
|
||||
|
||||
/** Holds if `dom` is an immediate post-dominator of `bb`. */
|
||||
predicate bbIPostDominates(BasicBlock dom, BasicBlock bb) =
|
||||
deprecated predicate bbIPostDominates(BasicBlock dom, BasicBlock bb) =
|
||||
idominance(exitBB/1, predBB/2)(_, dom, bb)
|
||||
|
||||
/**
|
||||
* An entry basic block, that is, a basic block whose first node is
|
||||
* the entry node of a callable.
|
||||
*/
|
||||
class EntryBasicBlock extends BasicBlock {
|
||||
deprecated class EntryBasicBlock extends BasicBlock {
|
||||
EntryBasicBlock() { entryBB(this) }
|
||||
}
|
||||
|
||||
/** Holds if `bb` is an entry basic block. */
|
||||
private predicate entryBB(BasicBlock bb) { bb.getFirstNode() instanceof MethodImplementation }
|
||||
deprecated private predicate entryBB(BasicBlock bb) {
|
||||
bb.getFirstNode() instanceof MethodImplementation
|
||||
}
|
||||
|
||||
/**
|
||||
* An exit basic block, that is, a basic block whose last node is
|
||||
* an exit node.
|
||||
*/
|
||||
class ExitBasicBlock extends BasicBlock {
|
||||
deprecated class ExitBasicBlock extends BasicBlock {
|
||||
ExitBasicBlock() { exitBB(this) }
|
||||
}
|
||||
|
||||
/** Holds if `bb` is an exit basic block. */
|
||||
private predicate exitBB(BasicBlock bb) { not exists(bb.getLastNode().getASuccessor()) }
|
||||
deprecated private predicate exitBB(BasicBlock bb) { not exists(bb.getLastNode().getASuccessor()) }
|
||||
|
||||
/**
|
||||
* A basic block with more than one predecessor.
|
||||
*/
|
||||
class JoinBlock extends BasicBlock {
|
||||
deprecated class JoinBlock extends BasicBlock {
|
||||
JoinBlock() { this.getFirstNode().isJoin() }
|
||||
}
|
||||
|
||||
/** A basic block that terminates in a condition, splitting the subsequent control flow. */
|
||||
class ConditionBlock extends BasicBlock {
|
||||
deprecated class ConditionBlock extends BasicBlock {
|
||||
ConditionBlock() {
|
||||
exists(BasicBlock succ |
|
||||
succ = this.getATrueSuccessor()
|
||||
|
||||
@@ -8,22 +8,26 @@ cached
|
||||
private module Cached {
|
||||
/** Holds if method `m` always returns null. */
|
||||
cached
|
||||
predicate alwaysNullMethod(Method m) { forex(Expr e | m.canReturn(e) | alwaysNullExpr(e)) }
|
||||
deprecated predicate alwaysNullMethod(Method m) {
|
||||
forex(Expr e | m.canReturn(e) | alwaysNullExpr(e))
|
||||
}
|
||||
|
||||
/** Holds if method `m` always returns non-null. */
|
||||
cached
|
||||
predicate alwaysNotNullMethod(Method m) { forex(Expr e | m.canReturn(e) | alwaysNotNullExpr(e)) }
|
||||
deprecated predicate alwaysNotNullMethod(Method m) {
|
||||
forex(Expr e | m.canReturn(e) | alwaysNotNullExpr(e))
|
||||
}
|
||||
|
||||
/** Holds if method `m` always throws an exception. */
|
||||
cached
|
||||
predicate alwaysThrowsMethod(Method m) {
|
||||
deprecated predicate alwaysThrowsMethod(Method m) {
|
||||
m.hasBody() and
|
||||
not exists(m.getImplementation().getAnInstruction().(Return))
|
||||
}
|
||||
|
||||
/** Holds if method `m` always throws an exception of type `t`. */
|
||||
cached
|
||||
predicate alwaysThrowsException(Method m, Type t) {
|
||||
deprecated predicate alwaysThrowsException(Method m, Type t) {
|
||||
alwaysThrowsMethod(m) and
|
||||
forex(Throw ex | ex = m.getImplementation().getAnInstruction() | t = ex.getExceptionType())
|
||||
}
|
||||
@@ -32,12 +36,12 @@ private module Cached {
|
||||
import Cached
|
||||
|
||||
pragma[noinline]
|
||||
private predicate alwaysNullVariableUpdate(VariableUpdate vu) {
|
||||
deprecated private predicate alwaysNullVariableUpdate(VariableUpdate vu) {
|
||||
forex(Expr src | src = vu.getSource() | alwaysNullExpr(src))
|
||||
}
|
||||
|
||||
/** Holds if expression `expr` always evaluates to `null`. */
|
||||
private predicate alwaysNullExpr(Expr expr) {
|
||||
deprecated private predicate alwaysNullExpr(Expr expr) {
|
||||
expr instanceof NullLiteral
|
||||
or
|
||||
alwaysNullMethod(expr.(StaticCall).getTarget())
|
||||
@@ -50,12 +54,12 @@ private predicate alwaysNullExpr(Expr expr) {
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
private predicate alwaysNotNullVariableUpdate(VariableUpdate vu) {
|
||||
deprecated private predicate alwaysNotNullVariableUpdate(VariableUpdate vu) {
|
||||
forex(Expr src | src = vu.getSource() | alwaysNotNullExpr(src))
|
||||
}
|
||||
|
||||
/** Holds if expression `expr` always evaluates to non-null. */
|
||||
private predicate alwaysNotNullExpr(Expr expr) {
|
||||
deprecated private predicate alwaysNotNullExpr(Expr expr) {
|
||||
expr instanceof Opcodes::NewObj
|
||||
or
|
||||
expr instanceof Literal and not expr instanceof NullLiteral
|
||||
|
||||
@@ -8,15 +8,15 @@ private import semmle.code.csharp.commons.QualifiedName
|
||||
|
||||
private newtype ConsistencyCheck =
|
||||
MissingEntityCheck() or
|
||||
TypeCheck(Type t) or
|
||||
CfgCheck(ControlFlowNode n) or
|
||||
DeclarationCheck(Declaration d) or
|
||||
deprecated TypeCheck(Type t) or
|
||||
deprecated CfgCheck(ControlFlowNode n) or
|
||||
deprecated DeclarationCheck(Declaration d) or
|
||||
MissingCSharpCheck(CS::Declaration d)
|
||||
|
||||
/**
|
||||
* A consistency violation in the database or data model.
|
||||
*/
|
||||
abstract class ConsistencyViolation extends ConsistencyCheck {
|
||||
abstract deprecated class ConsistencyViolation extends ConsistencyCheck {
|
||||
abstract string toString();
|
||||
|
||||
abstract string getMessage();
|
||||
@@ -25,14 +25,14 @@ abstract class ConsistencyViolation extends ConsistencyCheck {
|
||||
/**
|
||||
* A check that is deliberately disabled.
|
||||
*/
|
||||
abstract class DisabledCheck extends ConsistencyViolation {
|
||||
abstract deprecated class DisabledCheck extends ConsistencyViolation {
|
||||
DisabledCheck() { none() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A consistency violation on a control flow node.
|
||||
*/
|
||||
abstract class CfgViolation extends ConsistencyViolation, CfgCheck {
|
||||
abstract deprecated class CfgViolation extends ConsistencyViolation, CfgCheck {
|
||||
ControlFlowNode node;
|
||||
|
||||
CfgViolation() { this = CfgCheck(node) }
|
||||
@@ -43,7 +43,7 @@ abstract class CfgViolation extends ConsistencyViolation, CfgCheck {
|
||||
/**
|
||||
* A consistency violation in a specific instruction.
|
||||
*/
|
||||
abstract class InstructionViolation extends CfgViolation, CfgCheck {
|
||||
abstract deprecated class InstructionViolation extends CfgViolation, CfgCheck {
|
||||
Instruction instruction;
|
||||
|
||||
InstructionViolation() { this = CfgCheck(instruction) }
|
||||
@@ -70,7 +70,7 @@ abstract class InstructionViolation extends CfgViolation, CfgCheck {
|
||||
/**
|
||||
* A literal that does not have exactly one `getValue()`.
|
||||
*/
|
||||
class MissingValue extends InstructionViolation {
|
||||
deprecated class MissingValue extends InstructionViolation {
|
||||
MissingValue() { exists(Literal l | l = instruction | count(l.getValue()) != 1) }
|
||||
|
||||
override string getMessage() { result = "Literal has invalid getValue()" }
|
||||
@@ -79,7 +79,7 @@ class MissingValue extends InstructionViolation {
|
||||
/**
|
||||
* A call that does not have exactly one `getTarget()`.
|
||||
*/
|
||||
class MissingCallTarget extends InstructionViolation {
|
||||
deprecated class MissingCallTarget extends InstructionViolation {
|
||||
MissingCallTarget() {
|
||||
exists(Call c | c = instruction |
|
||||
count(c.getTarget()) != 1 and not c instanceof Opcodes::Calli
|
||||
@@ -94,7 +94,7 @@ class MissingCallTarget extends InstructionViolation {
|
||||
/**
|
||||
* An instruction that has not been assigned a specific QL class.
|
||||
*/
|
||||
class MissingOpCode extends InstructionViolation {
|
||||
deprecated class MissingOpCode extends InstructionViolation {
|
||||
MissingOpCode() { not exists(instruction.getOpcodeName()) }
|
||||
|
||||
override string getMessage() {
|
||||
@@ -114,7 +114,7 @@ class MissingOpCode extends InstructionViolation {
|
||||
* It could also mean that the target of a call has failed and has not determined the
|
||||
* correct number of arguments.
|
||||
*/
|
||||
class MissingOperand extends InstructionViolation {
|
||||
deprecated class MissingOperand extends InstructionViolation {
|
||||
MissingOperand() {
|
||||
exists(int op | op in [0 .. instruction.getPopCount() - 1] |
|
||||
not exists(instruction.getOperand(op)) and not instruction instanceof DeadInstruction
|
||||
@@ -136,7 +136,7 @@ class MissingOperand extends InstructionViolation {
|
||||
* These should not exist, however it turns out that the Mono compiler sometimes
|
||||
* emits them.
|
||||
*/
|
||||
class DeadInstruction extends Instruction {
|
||||
deprecated class DeadInstruction extends Instruction {
|
||||
DeadInstruction() { not exists(EntryPoint e | e.getASuccessor+() = this) }
|
||||
}
|
||||
|
||||
@@ -146,20 +146,20 @@ class DeadInstruction extends Instruction {
|
||||
* If this fails, it means that the calculation of the call graph is incorrect.
|
||||
* Disabled, because Mono compiler sometimes emits dead instructions.
|
||||
*/
|
||||
class DeadInstructionViolation extends InstructionViolation, DisabledCheck {
|
||||
deprecated class DeadInstructionViolation extends InstructionViolation, DisabledCheck {
|
||||
DeadInstructionViolation() { instruction instanceof DeadInstruction }
|
||||
|
||||
override string getMessage() { result = "This instruction is not reachable" }
|
||||
}
|
||||
|
||||
class YesNoBranch extends ConditionalBranch {
|
||||
deprecated class YesNoBranch extends ConditionalBranch {
|
||||
YesNoBranch() { not this instanceof Opcodes::Switch }
|
||||
}
|
||||
|
||||
/**
|
||||
* A branch instruction that does not have exactly 2 successors.
|
||||
*/
|
||||
class InvalidBranchSuccessors extends InstructionViolation {
|
||||
deprecated class InvalidBranchSuccessors extends InstructionViolation {
|
||||
InvalidBranchSuccessors() {
|
||||
// Mono compiler sometimes generates branches to the next instruction, which is just wrong.
|
||||
// However it is valid CIL.
|
||||
@@ -174,7 +174,7 @@ class InvalidBranchSuccessors extends InstructionViolation {
|
||||
/**
|
||||
* An instruction that has a true/false successor but is not a branch.
|
||||
*/
|
||||
class OnlyYesNoBranchHasTrueFalseSuccessors extends InstructionViolation {
|
||||
deprecated class OnlyYesNoBranchHasTrueFalseSuccessors extends InstructionViolation {
|
||||
OnlyYesNoBranchHasTrueFalseSuccessors() {
|
||||
(exists(instruction.getTrueSuccessor()) or exists(instruction.getFalseSuccessor())) and
|
||||
not instruction instanceof YesNoBranch
|
||||
@@ -186,7 +186,7 @@ class OnlyYesNoBranchHasTrueFalseSuccessors extends InstructionViolation {
|
||||
/**
|
||||
* An unconditional branch instruction that has more than one successor.
|
||||
*/
|
||||
class UnconditionalBranchSuccessors extends InstructionViolation {
|
||||
deprecated class UnconditionalBranchSuccessors extends InstructionViolation {
|
||||
UnconditionalBranchSuccessors() {
|
||||
exists(UnconditionalBranch i | i = instruction | count(i.getASuccessor()) != 1)
|
||||
}
|
||||
@@ -199,7 +199,7 @@ class UnconditionalBranchSuccessors extends InstructionViolation {
|
||||
/**
|
||||
* A branch instruction that does not have a true successor.
|
||||
*/
|
||||
class NoTrueSuccessor extends InstructionViolation {
|
||||
deprecated class NoTrueSuccessor extends InstructionViolation {
|
||||
NoTrueSuccessor() { exists(YesNoBranch i | i = instruction | not exists(i.getTrueSuccessor())) }
|
||||
|
||||
override string getMessage() { result = "Missing a true successor" }
|
||||
@@ -208,7 +208,7 @@ class NoTrueSuccessor extends InstructionViolation {
|
||||
/**
|
||||
* A branch instruction that does not have a false successor.
|
||||
*/
|
||||
class NoFalseSuccessor extends InstructionViolation {
|
||||
deprecated class NoFalseSuccessor extends InstructionViolation {
|
||||
NoFalseSuccessor() { exists(YesNoBranch i | i = instruction | not exists(i.getFalseSuccessor())) }
|
||||
|
||||
override string getMessage() { result = "Missing a false successor" }
|
||||
@@ -217,7 +217,7 @@ class NoFalseSuccessor extends InstructionViolation {
|
||||
/**
|
||||
* An instruction whose true successor is not a successor.
|
||||
*/
|
||||
class TrueSuccessorIsSuccessor extends InstructionViolation {
|
||||
deprecated class TrueSuccessorIsSuccessor extends InstructionViolation {
|
||||
TrueSuccessorIsSuccessor() {
|
||||
exists(instruction.getTrueSuccessor()) and
|
||||
not instruction.getTrueSuccessor() = instruction.getASuccessor()
|
||||
@@ -229,7 +229,7 @@ class TrueSuccessorIsSuccessor extends InstructionViolation {
|
||||
/**
|
||||
* An instruction whose false successor is not a successor.
|
||||
*/
|
||||
class FalseSuccessorIsSuccessor extends InstructionViolation {
|
||||
deprecated class FalseSuccessorIsSuccessor extends InstructionViolation {
|
||||
FalseSuccessorIsSuccessor() {
|
||||
exists(instruction.getFalseSuccessor()) and
|
||||
not instruction.getFalseSuccessor() = instruction.getASuccessor()
|
||||
@@ -241,7 +241,7 @@ class FalseSuccessorIsSuccessor extends InstructionViolation {
|
||||
/**
|
||||
* An access that does not have exactly one target.
|
||||
*/
|
||||
class AccessMissingTarget extends InstructionViolation {
|
||||
deprecated class AccessMissingTarget extends InstructionViolation {
|
||||
AccessMissingTarget() { exists(Access i | i = instruction | count(i.getTarget()) != 1) }
|
||||
|
||||
override string getMessage() { result = "Access has invalid getTarget()" }
|
||||
@@ -250,7 +250,7 @@ class AccessMissingTarget extends InstructionViolation {
|
||||
/**
|
||||
* A catch handler that doesn't have a caught exception type.
|
||||
*/
|
||||
class CatchHandlerMissingType extends CfgViolation {
|
||||
deprecated class CatchHandlerMissingType extends CfgViolation {
|
||||
CatchHandlerMissingType() { exists(CatchHandler h | h = node | not exists(h.getCaughtType())) }
|
||||
|
||||
override string getMessage() { result = "Catch handler missing caught type" }
|
||||
@@ -259,7 +259,7 @@ class CatchHandlerMissingType extends CfgViolation {
|
||||
/**
|
||||
* A CFG node that does not have a stack size.
|
||||
*/
|
||||
class MissingStackSize extends CfgViolation {
|
||||
deprecated class MissingStackSize extends CfgViolation {
|
||||
MissingStackSize() {
|
||||
(
|
||||
not exists(node.getStackSizeAfter()) or
|
||||
@@ -275,7 +275,7 @@ class MissingStackSize extends CfgViolation {
|
||||
* A CFG node that does not have exactly one stack size.
|
||||
* Disabled because inconsistent stack sizes have been observed.
|
||||
*/
|
||||
class InvalidStackSize extends CfgViolation, DisabledCheck {
|
||||
deprecated class InvalidStackSize extends CfgViolation, DisabledCheck {
|
||||
InvalidStackSize() {
|
||||
(
|
||||
count(node.getStackSizeAfter()) != 1 or
|
||||
@@ -294,7 +294,7 @@ class InvalidStackSize extends CfgViolation, DisabledCheck {
|
||||
/**
|
||||
* A CFG node that does not have exactly 1 `getPopCount()`.
|
||||
*/
|
||||
class InconsistentPopCount extends CfgViolation {
|
||||
deprecated class InconsistentPopCount extends CfgViolation {
|
||||
InconsistentPopCount() { count(node.getPopCount()) != 1 }
|
||||
|
||||
override string getMessage() {
|
||||
@@ -305,7 +305,7 @@ class InconsistentPopCount extends CfgViolation {
|
||||
/**
|
||||
* A CFG node that does not have exactly one `getPushCount()`.
|
||||
*/
|
||||
class InconsistentPushCount extends CfgViolation {
|
||||
deprecated class InconsistentPushCount extends CfgViolation {
|
||||
InconsistentPushCount() { count(node.getPushCount()) != 1 }
|
||||
|
||||
override string getMessage() {
|
||||
@@ -316,7 +316,7 @@ class InconsistentPushCount extends CfgViolation {
|
||||
/**
|
||||
* A return instruction that does not have a stack size of 0 after it.
|
||||
*/
|
||||
class InvalidReturn extends InstructionViolation {
|
||||
deprecated class InvalidReturn extends InstructionViolation {
|
||||
InvalidReturn() { instruction instanceof Return and instruction.getStackSizeAfter() != 0 }
|
||||
|
||||
override string getMessage() { result = "Return has invalid stack size" }
|
||||
@@ -325,7 +325,7 @@ class InvalidReturn extends InstructionViolation {
|
||||
/**
|
||||
* A throw instruction that does not have a stack size of 0 after it.
|
||||
*/
|
||||
class InvalidThrow extends InstructionViolation, DisabledCheck {
|
||||
deprecated class InvalidThrow extends InstructionViolation, DisabledCheck {
|
||||
InvalidThrow() { instruction instanceof Throw and instruction.getStackSizeAfter() != 0 }
|
||||
|
||||
override string getMessage() {
|
||||
@@ -336,7 +336,7 @@ class InvalidThrow extends InstructionViolation, DisabledCheck {
|
||||
/**
|
||||
* A field access where the field is "static" but the instruction is "instance".
|
||||
*/
|
||||
class StaticFieldTarget extends InstructionViolation {
|
||||
deprecated class StaticFieldTarget extends InstructionViolation {
|
||||
StaticFieldTarget() {
|
||||
exists(FieldAccess i | i = instruction |
|
||||
(i instanceof Opcodes::Stfld or i instanceof Opcodes::Stfld) and
|
||||
@@ -350,7 +350,7 @@ class StaticFieldTarget extends InstructionViolation {
|
||||
/**
|
||||
* A branch without a target.
|
||||
*/
|
||||
class BranchWithoutTarget extends InstructionViolation {
|
||||
deprecated class BranchWithoutTarget extends InstructionViolation {
|
||||
BranchWithoutTarget() {
|
||||
instruction = any(Branch b | not exists(b.getTarget()) and not b instanceof Opcodes::Switch)
|
||||
}
|
||||
@@ -361,7 +361,7 @@ class BranchWithoutTarget extends InstructionViolation {
|
||||
/**
|
||||
* A consistency violation in a type.
|
||||
*/
|
||||
class TypeViolation extends ConsistencyViolation, TypeCheck {
|
||||
deprecated class TypeViolation extends ConsistencyViolation, TypeCheck {
|
||||
/** Gets the type containing the violation. */
|
||||
Type getType() { this = TypeCheck(result) }
|
||||
|
||||
@@ -373,7 +373,7 @@ class TypeViolation extends ConsistencyViolation, TypeCheck {
|
||||
/**
|
||||
* A type that has both type arguments and type parameters.
|
||||
*/
|
||||
class TypeIsBothConstructedAndUnbound extends TypeViolation {
|
||||
deprecated class TypeIsBothConstructedAndUnbound extends TypeViolation {
|
||||
TypeIsBothConstructedAndUnbound() {
|
||||
this.getType() instanceof ConstructedGeneric and this.getType() instanceof UnboundGeneric
|
||||
}
|
||||
@@ -385,7 +385,7 @@ class TypeIsBothConstructedAndUnbound extends TypeViolation {
|
||||
* The location of a constructed generic type should be the same
|
||||
* as the location of its unbound generic type.
|
||||
*/
|
||||
class InconsistentTypeLocation extends TypeViolation {
|
||||
deprecated class InconsistentTypeLocation extends TypeViolation {
|
||||
InconsistentTypeLocation() {
|
||||
this.getType().getLocation() != this.getType().getUnboundDeclaration().getLocation()
|
||||
}
|
||||
@@ -396,7 +396,7 @@ class InconsistentTypeLocation extends TypeViolation {
|
||||
/**
|
||||
* A constructed type that does not match its unbound generic type.
|
||||
*/
|
||||
class TypeParameterMismatch extends TypeViolation {
|
||||
deprecated class TypeParameterMismatch extends TypeViolation {
|
||||
TypeParameterMismatch() {
|
||||
this.getType().(ConstructedGeneric).getNumberOfTypeArguments() !=
|
||||
this.getType().getUnboundType().(UnboundGeneric).getNumberOfTypeParameters()
|
||||
@@ -415,7 +415,7 @@ class TypeParameterMismatch extends TypeViolation {
|
||||
/**
|
||||
* A consistency violation in a method.
|
||||
*/
|
||||
class MethodViolation extends ConsistencyViolation, DeclarationCheck {
|
||||
deprecated class MethodViolation extends ConsistencyViolation, DeclarationCheck {
|
||||
/** Gets the method containing the violation. */
|
||||
Method getMethod() { this = DeclarationCheck(result) }
|
||||
|
||||
@@ -428,7 +428,7 @@ class MethodViolation extends ConsistencyViolation, DeclarationCheck {
|
||||
* The location of a constructed method should be equal to the
|
||||
* location of its unbound generic.
|
||||
*/
|
||||
class InconsistentMethodLocation extends MethodViolation {
|
||||
deprecated class InconsistentMethodLocation extends MethodViolation {
|
||||
InconsistentMethodLocation() {
|
||||
this.getMethod().getLocation() != this.getMethod().getUnboundDeclaration().getLocation()
|
||||
}
|
||||
@@ -439,7 +439,7 @@ class InconsistentMethodLocation extends MethodViolation {
|
||||
/**
|
||||
* A constructed method that does not match its unbound method.
|
||||
*/
|
||||
class ConstructedMethodTypeParams extends MethodViolation {
|
||||
deprecated class ConstructedMethodTypeParams extends MethodViolation {
|
||||
ConstructedMethodTypeParams() {
|
||||
this.getMethod().(ConstructedGeneric).getNumberOfTypeArguments() !=
|
||||
this.getMethod().getUnboundDeclaration().(UnboundGeneric).getNumberOfTypeParameters()
|
||||
@@ -456,14 +456,14 @@ class ConstructedMethodTypeParams extends MethodViolation {
|
||||
/**
|
||||
* A violation marking an entity that should be present but is not.
|
||||
*/
|
||||
abstract class MissingEntityViolation extends ConsistencyViolation, MissingEntityCheck {
|
||||
abstract deprecated class MissingEntityViolation extends ConsistencyViolation, MissingEntityCheck {
|
||||
override string toString() { result = "Missing entity" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The type `object` is missing from the database.
|
||||
*/
|
||||
class MissingObjectViolation extends MissingEntityViolation {
|
||||
deprecated class MissingObjectViolation extends MissingEntityViolation {
|
||||
MissingObjectViolation() {
|
||||
exists(this) and
|
||||
not exists(ObjectType o)
|
||||
@@ -475,7 +475,7 @@ class MissingObjectViolation extends MissingEntityViolation {
|
||||
/**
|
||||
* An override that is invalid because the overridden method is not in a base class.
|
||||
*/
|
||||
class InvalidOverride extends MethodViolation {
|
||||
deprecated class InvalidOverride extends MethodViolation {
|
||||
private Method base;
|
||||
|
||||
InvalidOverride() {
|
||||
@@ -497,7 +497,7 @@ class InvalidOverride extends MethodViolation {
|
||||
/**
|
||||
* A pointer type that does not have a pointee type.
|
||||
*/
|
||||
class InvalidPointerType extends TypeViolation {
|
||||
deprecated class InvalidPointerType extends TypeViolation {
|
||||
InvalidPointerType() {
|
||||
exists(PointerType p | p = this.getType() | count(p.getReferentType()) != 1)
|
||||
}
|
||||
@@ -508,7 +508,7 @@ class InvalidPointerType extends TypeViolation {
|
||||
/**
|
||||
* An array with an invalid `getElementType`.
|
||||
*/
|
||||
class ArrayTypeMissingElement extends TypeViolation {
|
||||
deprecated class ArrayTypeMissingElement extends TypeViolation {
|
||||
ArrayTypeMissingElement() {
|
||||
exists(ArrayType t | t = this.getType() | count(t.getElementType()) != 1)
|
||||
}
|
||||
@@ -519,7 +519,7 @@ class ArrayTypeMissingElement extends TypeViolation {
|
||||
/**
|
||||
* An array with an invalid `getRank`.
|
||||
*/
|
||||
class ArrayTypeInvalidRank extends TypeViolation {
|
||||
deprecated class ArrayTypeInvalidRank extends TypeViolation {
|
||||
ArrayTypeInvalidRank() { exists(ArrayType t | t = this.getType() | not t.getRank() > 0) }
|
||||
|
||||
override string getMessage() { result = "Invalid ArrayType.getRank()" }
|
||||
@@ -529,7 +529,7 @@ class ArrayTypeInvalidRank extends TypeViolation {
|
||||
* A type should have at most one kind, except for missing referenced types
|
||||
* where the interface/class is unknown.
|
||||
*/
|
||||
class KindViolation extends TypeViolation {
|
||||
deprecated class KindViolation extends TypeViolation {
|
||||
KindViolation() {
|
||||
count(typeKind(this.getType())) != 1 and
|
||||
exists(this.getType().getLocation())
|
||||
@@ -544,7 +544,7 @@ class KindViolation extends TypeViolation {
|
||||
* The type of a kind must be consistent between a constructed generic and its
|
||||
* unbound generic.
|
||||
*/
|
||||
class InconsistentKind extends TypeViolation {
|
||||
deprecated class InconsistentKind extends TypeViolation {
|
||||
InconsistentKind() {
|
||||
typeKind(this.getType()) != typeKind(this.getType().getUnboundDeclaration())
|
||||
}
|
||||
@@ -552,7 +552,7 @@ class InconsistentKind extends TypeViolation {
|
||||
override string getMessage() { result = "Inconsistent type kind of source declaration" }
|
||||
}
|
||||
|
||||
private string typeKind(Type t) {
|
||||
deprecated private string typeKind(Type t) {
|
||||
t instanceof Interface and result = "interface"
|
||||
or
|
||||
t instanceof Class and result = "class"
|
||||
@@ -567,7 +567,7 @@ private string typeKind(Type t) {
|
||||
/**
|
||||
* A violation in a `Member`.
|
||||
*/
|
||||
abstract class DeclarationViolation extends ConsistencyViolation, DeclarationCheck {
|
||||
abstract deprecated class DeclarationViolation extends ConsistencyViolation, DeclarationCheck {
|
||||
abstract override string getMessage();
|
||||
|
||||
/** Gets the member containing the potential violation. */
|
||||
@@ -579,7 +579,7 @@ abstract class DeclarationViolation extends ConsistencyViolation, DeclarationChe
|
||||
/**
|
||||
* Properties that have no accessors.
|
||||
*/
|
||||
class PropertyWithNoAccessors extends DeclarationViolation {
|
||||
deprecated class PropertyWithNoAccessors extends DeclarationViolation {
|
||||
PropertyWithNoAccessors() {
|
||||
exists(Property p | p = this.getDeclaration() | not exists(p.getAnAccessor()))
|
||||
}
|
||||
@@ -590,7 +590,7 @@ class PropertyWithNoAccessors extends DeclarationViolation {
|
||||
/**
|
||||
* An expression that have an unexpected push count.
|
||||
*/
|
||||
class ExprPushCount extends InstructionViolation {
|
||||
deprecated class ExprPushCount extends InstructionViolation {
|
||||
ExprPushCount() {
|
||||
instruction instanceof Expr and
|
||||
not instruction instanceof Opcodes::Dup and
|
||||
@@ -608,7 +608,7 @@ class ExprPushCount extends InstructionViolation {
|
||||
* An expression that does not have exactly one type.
|
||||
* Note that calls with no return have type `System.Void`.
|
||||
*/
|
||||
class ExprMissingType extends InstructionViolation {
|
||||
deprecated class ExprMissingType extends InstructionViolation {
|
||||
ExprMissingType() {
|
||||
// Don't have types for the following op codes:
|
||||
not instruction instanceof Opcodes::Ldftn and
|
||||
@@ -632,7 +632,7 @@ class ExprMissingType extends InstructionViolation {
|
||||
/**
|
||||
* An instruction that has a push count of 0, yet is still used as an operand
|
||||
*/
|
||||
class InvalidExpressionViolation extends InstructionViolation {
|
||||
deprecated class InvalidExpressionViolation extends InstructionViolation {
|
||||
InvalidExpressionViolation() {
|
||||
instruction.getPushCount() = 0 and
|
||||
exists(Instruction expr | instruction = expr.getAnOperand())
|
||||
@@ -647,7 +647,7 @@ class InvalidExpressionViolation extends InstructionViolation {
|
||||
* A type that has multiple entities with the same qualified name in `System`.
|
||||
* .NET Core does sometimes duplicate types, so this check is disabled.
|
||||
*/
|
||||
class TypeMultiplyDefined extends TypeViolation, DisabledCheck {
|
||||
deprecated class TypeMultiplyDefined extends TypeViolation, DisabledCheck {
|
||||
TypeMultiplyDefined() {
|
||||
this.getType().getParent().getName() = "System" and
|
||||
not this.getType() instanceof ConstructedGeneric and
|
||||
@@ -672,7 +672,7 @@ class TypeMultiplyDefined extends TypeViolation, DisabledCheck {
|
||||
/**
|
||||
* A C# declaration which is expected to have a corresponding CIL declaration, but for some reason does not.
|
||||
*/
|
||||
class MissingCilDeclaration extends ConsistencyViolation, MissingCSharpCheck {
|
||||
deprecated class MissingCilDeclaration extends ConsistencyViolation, MissingCSharpCheck {
|
||||
MissingCilDeclaration() {
|
||||
exists(CS::Declaration decl | this = MissingCSharpCheck(decl) |
|
||||
expectedCilDeclaration(decl) and
|
||||
@@ -694,7 +694,7 @@ class MissingCilDeclaration extends ConsistencyViolation, MissingCSharpCheck {
|
||||
/**
|
||||
* Holds if the C# declaration is expected to have a CIl declaration.
|
||||
*/
|
||||
private predicate expectedCilDeclaration(CS::Declaration decl) {
|
||||
deprecated private predicate expectedCilDeclaration(CS::Declaration decl) {
|
||||
decl = decl.getUnboundDeclaration() and
|
||||
not decl instanceof CS::ArrayType and
|
||||
decl.getALocation() instanceof CS::Assembly and
|
||||
@@ -730,7 +730,7 @@ private predicate expectedCilDeclaration(CS::Declaration decl) {
|
||||
}
|
||||
|
||||
/** A member with an invalid name. */
|
||||
class MemberWithInvalidName extends DeclarationViolation {
|
||||
deprecated class MemberWithInvalidName extends DeclarationViolation {
|
||||
MemberWithInvalidName() {
|
||||
exists(string name | name = this.getDeclaration().(Member).getName() |
|
||||
exists(name.indexOf(".")) and
|
||||
@@ -744,7 +744,7 @@ class MemberWithInvalidName extends DeclarationViolation {
|
||||
}
|
||||
}
|
||||
|
||||
class ConstructedSourceDeclarationMethod extends MethodViolation {
|
||||
deprecated class ConstructedSourceDeclarationMethod extends MethodViolation {
|
||||
Method method;
|
||||
|
||||
ConstructedSourceDeclarationMethod() {
|
||||
@@ -762,7 +762,7 @@ class ConstructedSourceDeclarationMethod extends MethodViolation {
|
||||
}
|
||||
|
||||
/** A declaration with multiple labels. */
|
||||
class DeclarationWithMultipleLabels extends DeclarationViolation {
|
||||
deprecated class DeclarationWithMultipleLabels extends DeclarationViolation {
|
||||
DeclarationWithMultipleLabels() {
|
||||
exists(Declaration d | this = DeclarationCheck(d) | strictcount(d.getLabel()) > 1)
|
||||
}
|
||||
@@ -773,7 +773,7 @@ class DeclarationWithMultipleLabels extends DeclarationViolation {
|
||||
}
|
||||
|
||||
/** A declaration without a label. */
|
||||
class DeclarationWithoutLabel extends DeclarationViolation {
|
||||
deprecated class DeclarationWithoutLabel extends DeclarationViolation {
|
||||
DeclarationWithoutLabel() {
|
||||
exists(Declaration d | this = DeclarationCheck(d) |
|
||||
d.isUnboundDeclaration() and
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
private import CIL
|
||||
|
||||
/** A node in the control flow graph. */
|
||||
class ControlFlowNode extends @cil_controlflow_node {
|
||||
deprecated class ControlFlowNode extends @cil_controlflow_node {
|
||||
/** Gets a textual representation of this control flow node. */
|
||||
string toString() { none() }
|
||||
|
||||
@@ -149,31 +149,31 @@ class ControlFlowNode extends @cil_controlflow_node {
|
||||
*
|
||||
* Handlers are control flow nodes because they push the handled exception onto the stack.
|
||||
*/
|
||||
class EntryPoint extends ControlFlowNode, @cil_entry_point {
|
||||
deprecated class EntryPoint extends ControlFlowNode, @cil_entry_point {
|
||||
override int getStackSizeBefore() { result = 0 }
|
||||
}
|
||||
|
||||
private newtype TFlowType =
|
||||
deprecated private newtype TFlowType =
|
||||
TNormalFlow() or
|
||||
TTrueFlow() or
|
||||
TFalseFlow()
|
||||
|
||||
/** A type of control flow. Either normal flow (`NormalFlow`), true flow (`TrueFlow`) or false flow (`FalseFlow`). */
|
||||
abstract class FlowType extends TFlowType {
|
||||
abstract deprecated class FlowType extends TFlowType {
|
||||
abstract string toString();
|
||||
}
|
||||
|
||||
/** Normal control flow. */
|
||||
class NormalFlow extends FlowType, TNormalFlow {
|
||||
deprecated class NormalFlow extends FlowType, TNormalFlow {
|
||||
override string toString() { result = "" }
|
||||
}
|
||||
|
||||
/** True control flow. */
|
||||
class TrueFlow extends FlowType, TTrueFlow {
|
||||
deprecated class TrueFlow extends FlowType, TTrueFlow {
|
||||
override string toString() { result = "true" }
|
||||
}
|
||||
|
||||
/** False control flow. */
|
||||
class FalseFlow extends FlowType, TFalseFlow {
|
||||
deprecated class FalseFlow extends FlowType, TFalseFlow {
|
||||
override string toString() { result = "false" }
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ private import dotnet
|
||||
* - the type of parameters.
|
||||
* A `CustomModifierReceiver` is therefore either a `Field`, `Property`, `Method`, or `Parameter`.
|
||||
*/
|
||||
class CustomModifierReceiver extends Declaration, @cil_custom_modifier_receiver {
|
||||
deprecated class CustomModifierReceiver extends Declaration, @cil_custom_modifier_receiver {
|
||||
/** Holds if this targeted type has `modifier` applied as `modreq`. */
|
||||
predicate hasRequiredCustomModifier(Type modifier) { cil_custom_modifiers(this, modifier, 1) }
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ private import CIL
|
||||
*
|
||||
* Either an instruction (`Instruction`), a method return (`Method`), or a variable (`Variable`).
|
||||
*/
|
||||
class DataFlowNode extends @cil_dataflow_node {
|
||||
deprecated class DataFlowNode extends @cil_dataflow_node {
|
||||
/** Gets a textual representation of this data flow node. */
|
||||
abstract string toString();
|
||||
|
||||
@@ -24,7 +24,7 @@ class DataFlowNode extends @cil_dataflow_node {
|
||||
}
|
||||
|
||||
/** A node that updates a variable. */
|
||||
abstract class VariableUpdate extends DataFlowNode {
|
||||
abstract deprecated class VariableUpdate extends DataFlowNode {
|
||||
/** Gets the value assigned, if any. */
|
||||
abstract DataFlowNode getSource();
|
||||
|
||||
@@ -35,7 +35,7 @@ abstract class VariableUpdate extends DataFlowNode {
|
||||
abstract predicate updatesAt(BasicBlock bb, int i);
|
||||
}
|
||||
|
||||
private class MethodParameterDef extends VariableUpdate, MethodParameter {
|
||||
deprecated private class MethodParameterDef extends VariableUpdate, MethodParameter {
|
||||
override MethodParameter getSource() { result = this }
|
||||
|
||||
override MethodParameter getVariable() { result = this }
|
||||
@@ -46,7 +46,7 @@ private class MethodParameterDef extends VariableUpdate, MethodParameter {
|
||||
}
|
||||
}
|
||||
|
||||
private class VariableWrite extends VariableUpdate, WriteAccess {
|
||||
deprecated private class VariableWrite extends VariableUpdate, WriteAccess {
|
||||
override Expr getSource() { result = this.getExpr() }
|
||||
|
||||
override Variable getVariable() { result = this.getTarget() }
|
||||
@@ -54,7 +54,7 @@ private class VariableWrite extends VariableUpdate, WriteAccess {
|
||||
override predicate updatesAt(BasicBlock bb, int i) { this = bb.getNode(i) }
|
||||
}
|
||||
|
||||
private class MethodOutOrRefTarget extends VariableUpdate, Call {
|
||||
deprecated private class MethodOutOrRefTarget extends VariableUpdate, Call {
|
||||
int parameterIndex;
|
||||
|
||||
MethodOutOrRefTarget() { this.getTarget().getRawParameter(parameterIndex).hasOutFlag() }
|
||||
|
||||
@@ -10,7 +10,7 @@ private import semmle.code.csharp.commons.QualifiedName
|
||||
/**
|
||||
* A declaration. Either a member (`Member`) or a variable (`Variable`).
|
||||
*/
|
||||
class Declaration extends DotNet::Declaration, Element, @cil_declaration {
|
||||
deprecated class Declaration extends DotNet::Declaration, Element, @cil_declaration {
|
||||
/** Gets an attribute (for example `[Obsolete]`) of this declaration, if any. */
|
||||
Attribute getAnAttribute() { result.getDeclaration() = this }
|
||||
|
||||
@@ -42,14 +42,18 @@ class Declaration extends DotNet::Declaration, Element, @cil_declaration {
|
||||
}
|
||||
}
|
||||
|
||||
private CS::Declaration toCSharpNonTypeParameter(Declaration d) { result.matchesHandle(d) }
|
||||
deprecated private CS::Declaration toCSharpNonTypeParameter(Declaration d) {
|
||||
result.(DotNet::Declaration).matchesHandle(d)
|
||||
}
|
||||
|
||||
private CS::TypeParameter toCSharpTypeParameter(TypeParameter tp) {
|
||||
deprecated private CS::TypeParameter toCSharpTypeParameter(TypeParameter tp) {
|
||||
toCSharpTypeParameterJoin(tp, result.getIndex(), result.getGeneric())
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private predicate toCSharpTypeParameterJoin(TypeParameter tp, int i, CS::UnboundGeneric ug) {
|
||||
deprecated private predicate toCSharpTypeParameterJoin(
|
||||
TypeParameter tp, int i, CS::UnboundGeneric ug
|
||||
) {
|
||||
exists(TypeContainer tc |
|
||||
tp.getIndex() = i and
|
||||
tc = tp.getGeneric() and
|
||||
@@ -60,7 +64,7 @@ private predicate toCSharpTypeParameterJoin(TypeParameter tp, int i, CS::Unbound
|
||||
/**
|
||||
* A member of a type. Either a type (`Type`), a method (`Method`), a property (`Property`), or an event (`Event`).
|
||||
*/
|
||||
class Member extends DotNet::Member, Declaration, @cil_member {
|
||||
deprecated class Member extends DotNet::Member, Declaration, @cil_member {
|
||||
override predicate isPublic() { cil_public(this) }
|
||||
|
||||
override predicate isProtected() { cil_protected(this) }
|
||||
@@ -82,7 +86,7 @@ class Member extends DotNet::Member, Declaration, @cil_member {
|
||||
}
|
||||
|
||||
/** A property. */
|
||||
class Property extends DotNet::Property, Member, CustomModifierReceiver, @cil_property {
|
||||
deprecated class Property extends DotNet::Property, Member, CustomModifierReceiver, @cil_property {
|
||||
override string getName() { cil_property(this, _, result, _) }
|
||||
|
||||
/** Gets the type of this property. */
|
||||
@@ -109,7 +113,7 @@ class Property extends DotNet::Property, Member, CustomModifierReceiver, @cil_pr
|
||||
}
|
||||
|
||||
/** A property that is trivial (wraps a field). */
|
||||
class TrivialProperty extends Property {
|
||||
deprecated class TrivialProperty extends Property {
|
||||
TrivialProperty() {
|
||||
this.getGetter().(TrivialGetter).getField() = this.getSetter().(TrivialSetter).getField()
|
||||
}
|
||||
@@ -119,7 +123,7 @@ class TrivialProperty extends Property {
|
||||
}
|
||||
|
||||
/** An event. */
|
||||
class Event extends DotNet::Event, Member, @cil_event {
|
||||
deprecated class Event extends DotNet::Event, Member, @cil_event {
|
||||
override string getName() { cil_event(this, _, result, _) }
|
||||
|
||||
/** Gets the type of this event. */
|
||||
|
||||
@@ -4,12 +4,12 @@ private import dotnet
|
||||
import semmle.code.csharp.Location
|
||||
|
||||
/** An element. */
|
||||
class Element extends DotNet::Element, @cil_element {
|
||||
deprecated class Element extends DotNet::Element, @cil_element {
|
||||
override Location getLocation() { result = bestLocation(this) }
|
||||
}
|
||||
|
||||
cached
|
||||
private Location bestLocation(Element e) {
|
||||
deprecated private Location bestLocation(Element e) {
|
||||
result = e.getALocation() and
|
||||
(e.getALocation().getFile().isPdbSourceFile() implies result.getFile().isPdbSourceFile())
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ private import dotnet
|
||||
* A generic declaration. Either an unbound generic (`UnboundGeneric`) or a
|
||||
* constructed generic (`ConstructedGeneric`).
|
||||
*/
|
||||
class Generic extends DotNet::Generic, Declaration, TypeContainer {
|
||||
deprecated class Generic extends DotNet::Generic, Declaration, TypeContainer {
|
||||
Generic() {
|
||||
cil_type_parameter(this, _, _) or
|
||||
cil_type_argument(this, _, _)
|
||||
@@ -15,14 +15,14 @@ class Generic extends DotNet::Generic, Declaration, TypeContainer {
|
||||
}
|
||||
|
||||
/** An unbound generic type or method. */
|
||||
class UnboundGeneric extends Generic, DotNet::UnboundGeneric {
|
||||
deprecated class UnboundGeneric extends Generic, DotNet::UnboundGeneric {
|
||||
UnboundGeneric() { cil_type_parameter(this, _, _) }
|
||||
|
||||
final override TypeParameter getTypeParameter(int n) { cil_type_parameter(this, n, result) }
|
||||
}
|
||||
|
||||
/** A constructed generic type or method. */
|
||||
class ConstructedGeneric extends Generic, DotNet::ConstructedGeneric {
|
||||
deprecated class ConstructedGeneric extends Generic, DotNet::ConstructedGeneric {
|
||||
ConstructedGeneric() { cil_type_argument(this, _, _) }
|
||||
|
||||
final override Type getTypeArgument(int n) { cil_type_argument(this, n, result) }
|
||||
@@ -30,18 +30,18 @@ class ConstructedGeneric extends Generic, DotNet::ConstructedGeneric {
|
||||
|
||||
/** Gets the concatenation of the `getName()` of type arguments. */
|
||||
language[monotonicAggregates]
|
||||
private string getTypeArgumentsNames(ConstructedGeneric cg) {
|
||||
deprecated private string getTypeArgumentsNames(ConstructedGeneric cg) {
|
||||
result = strictconcat(Type t, int i | t = cg.getTypeArgument(i) | t.getName(), "," order by i)
|
||||
}
|
||||
|
||||
/** An unbound generic type. */
|
||||
class UnboundGenericType extends UnboundGeneric, Type { }
|
||||
deprecated class UnboundGenericType extends UnboundGeneric, Type { }
|
||||
|
||||
/** An unbound generic method. */
|
||||
class UnboundGenericMethod extends UnboundGeneric, Method { }
|
||||
deprecated class UnboundGenericMethod extends UnboundGeneric, Method { }
|
||||
|
||||
/** A constructed generic type. */
|
||||
class ConstructedType extends ConstructedGeneric, Type {
|
||||
deprecated class ConstructedType extends ConstructedGeneric, Type {
|
||||
final override UnboundGenericType getUnboundGeneric() { result = this.getUnboundType() }
|
||||
|
||||
override predicate isInterface() { this.getUnboundType().isInterface() }
|
||||
@@ -54,6 +54,6 @@ class ConstructedType extends ConstructedGeneric, Type {
|
||||
}
|
||||
|
||||
/** A constructed generic method. */
|
||||
class ConstructedMethod extends ConstructedGeneric, Method {
|
||||
deprecated class ConstructedMethod extends ConstructedGeneric, Method {
|
||||
final override UnboundGenericMethod getUnboundGeneric() { result = this.getUnboundMethod() }
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ private import CIL
|
||||
* Either a finally handler (`FinallyHandler`), filter handler (`FilterHandler`),
|
||||
* catch handler (`CatchHandler`), or a fault handler (`FaultHandler`).
|
||||
*/
|
||||
class Handler extends Element, EntryPoint, @cil_handler {
|
||||
deprecated class Handler extends Element, EntryPoint, @cil_handler {
|
||||
override MethodImplementation getImplementation() { cil_handler(this, result, _, _, _, _, _) }
|
||||
|
||||
/** Gets the 0-based index of this handler. Handlers are evaluated in this sequence. */
|
||||
@@ -56,12 +56,12 @@ class Handler extends Element, EntryPoint, @cil_handler {
|
||||
}
|
||||
|
||||
/** A handler corresponding to a `finally` block. */
|
||||
class FinallyHandler extends Handler, @cil_finally_handler {
|
||||
deprecated class FinallyHandler extends Handler, @cil_finally_handler {
|
||||
override string toString() { result = "finally {...}" }
|
||||
}
|
||||
|
||||
/** A handler corresponding to a `where()` clause. */
|
||||
class FilterHandler extends Handler, @cil_filter_handler {
|
||||
deprecated class FilterHandler extends Handler, @cil_filter_handler {
|
||||
override string toString() { result = "where (...)" }
|
||||
|
||||
/** Gets the filter clause - the start of a sequence of instructions to evaluate the filter function. */
|
||||
@@ -71,13 +71,13 @@ class FilterHandler extends Handler, @cil_filter_handler {
|
||||
}
|
||||
|
||||
/** A handler corresponding to a `catch` clause. */
|
||||
class CatchHandler extends Handler, @cil_catch_handler {
|
||||
deprecated class CatchHandler extends Handler, @cil_catch_handler {
|
||||
override string toString() { result = "catch(" + this.getCaughtType().getName() + ") {...}" }
|
||||
|
||||
override int getPushCount() { result = 1 }
|
||||
}
|
||||
|
||||
/** A handler for memory faults. */
|
||||
class FaultHandler extends Handler, @cil_fault_handler {
|
||||
deprecated class FaultHandler extends Handler, @cil_fault_handler {
|
||||
override string toString() { result = "fault {...}" }
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
private import CIL
|
||||
|
||||
/** An instruction. */
|
||||
class Instruction extends Element, ControlFlowNode, DataFlowNode, @cil_instruction {
|
||||
deprecated class Instruction extends Element, ControlFlowNode, DataFlowNode, @cil_instruction {
|
||||
override string toString() { result = this.getOpcodeName() }
|
||||
|
||||
/** Gets a more verbose textual representation of this instruction. */
|
||||
|
||||
@@ -9,7 +9,7 @@ private import dotnet
|
||||
/**
|
||||
* An instruction that pushes a value onto the stack.
|
||||
*/
|
||||
class Expr extends DotNet::Expr, Instruction, @cil_expr {
|
||||
deprecated class Expr extends DotNet::Expr, Instruction, @cil_expr {
|
||||
override int getPushCount() { result = 1 }
|
||||
|
||||
override Type getType() { result = Instruction.super.getType() }
|
||||
@@ -24,7 +24,7 @@ class Expr extends DotNet::Expr, Instruction, @cil_expr {
|
||||
}
|
||||
|
||||
/** An instruction that changes control flow. */
|
||||
class Branch extends Instruction, @cil_jump {
|
||||
deprecated class Branch extends Instruction, @cil_jump {
|
||||
/** Gets the instruction that is jumped to. */
|
||||
Instruction getTarget() { cil_jump(this, result) }
|
||||
|
||||
@@ -32,7 +32,7 @@ class Branch extends Instruction, @cil_jump {
|
||||
}
|
||||
|
||||
/** An instruction that unconditionally jumps to another instruction. */
|
||||
class UnconditionalBranch extends Branch, @cil_unconditional_jump {
|
||||
deprecated class UnconditionalBranch extends Branch, @cil_unconditional_jump {
|
||||
override Instruction getASuccessorType(FlowType t) {
|
||||
t instanceof NormalFlow and result = this.getTarget()
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class UnconditionalBranch extends Branch, @cil_unconditional_jump {
|
||||
}
|
||||
|
||||
/** An instruction that jumps to a target based on a condition. */
|
||||
class ConditionalBranch extends Branch, @cil_conditional_jump {
|
||||
deprecated class ConditionalBranch extends Branch, @cil_conditional_jump {
|
||||
override Instruction getASuccessorType(FlowType t) {
|
||||
t instanceof TrueFlow and result = this.getTarget()
|
||||
or
|
||||
@@ -52,12 +52,12 @@ class ConditionalBranch extends Branch, @cil_conditional_jump {
|
||||
}
|
||||
|
||||
/** An expression with two operands. */
|
||||
class BinaryExpr extends Expr, @cil_binary_expr {
|
||||
deprecated class BinaryExpr extends Expr, @cil_binary_expr {
|
||||
override int getPopCount() { result = 2 }
|
||||
}
|
||||
|
||||
/** An expression with one operand. */
|
||||
class UnaryExpr extends Expr, @cil_unary_expr {
|
||||
deprecated class UnaryExpr extends Expr, @cil_unary_expr {
|
||||
override int getPopCount() { result = 1 }
|
||||
|
||||
/** Gets the operand of this unary expression. */
|
||||
@@ -65,12 +65,12 @@ class UnaryExpr extends Expr, @cil_unary_expr {
|
||||
}
|
||||
|
||||
/** A binary expression that compares two values. */
|
||||
class ComparisonOperation extends BinaryExpr, @cil_comparison_operation {
|
||||
deprecated class ComparisonOperation extends BinaryExpr, @cil_comparison_operation {
|
||||
override BoolType getType() { exists(result) }
|
||||
}
|
||||
|
||||
/** A binary arithmetic expression. */
|
||||
class BinaryArithmeticExpr extends BinaryExpr, @cil_binary_arithmetic_operation {
|
||||
deprecated class BinaryArithmeticExpr extends BinaryExpr, @cil_binary_arithmetic_operation {
|
||||
override Type getType() {
|
||||
exists(Type t0, Type t1 |
|
||||
t0 = this.getOperandType(0).getUnderlyingType() and
|
||||
@@ -86,28 +86,28 @@ class BinaryArithmeticExpr extends BinaryExpr, @cil_binary_arithmetic_operation
|
||||
}
|
||||
|
||||
/** A binary bitwise expression. */
|
||||
class BinaryBitwiseOperation extends BinaryExpr, @cil_binary_bitwise_operation {
|
||||
deprecated class BinaryBitwiseOperation extends BinaryExpr, @cil_binary_bitwise_operation {
|
||||
// This is wrong but efficient - should depend on the types of the operands.
|
||||
override IntType getType() { exists(result) }
|
||||
}
|
||||
|
||||
/** A unary bitwise expression. */
|
||||
class UnaryBitwiseOperation extends UnaryExpr, @cil_unary_bitwise_operation {
|
||||
deprecated class UnaryBitwiseOperation extends UnaryExpr, @cil_unary_bitwise_operation {
|
||||
// This is wrong but efficient - should depend on the types of the operands.
|
||||
override IntType getType() { exists(result) }
|
||||
}
|
||||
|
||||
/** A unary expression that converts a value from one primitive type to another. */
|
||||
class Conversion extends UnaryExpr, @cil_conversion_operation {
|
||||
deprecated class Conversion extends UnaryExpr, @cil_conversion_operation {
|
||||
/** Gets the expression being converted. */
|
||||
Expr getExpr() { result = this.getOperand(0) }
|
||||
}
|
||||
|
||||
/** A branch that leaves the scope of a `Handler`. */
|
||||
class Leave extends UnconditionalBranch, @cil_leave_any { }
|
||||
deprecated class Leave extends UnconditionalBranch, @cil_leave_any { }
|
||||
|
||||
/** An expression that pushes a literal value onto the stack. */
|
||||
class Literal extends DotNet::Literal, Expr, @cil_literal {
|
||||
deprecated class Literal extends DotNet::Literal, Expr, @cil_literal {
|
||||
/** Gets the pushed value. */
|
||||
override string getValue() { cil_value(this, result) }
|
||||
|
||||
@@ -115,37 +115,37 @@ class Literal extends DotNet::Literal, Expr, @cil_literal {
|
||||
}
|
||||
|
||||
/** An integer literal. */
|
||||
class IntLiteral extends Literal, @cil_ldc_i {
|
||||
deprecated class IntLiteral extends Literal, @cil_ldc_i {
|
||||
override string getExtra() { none() }
|
||||
|
||||
override IntType getType() { exists(result) }
|
||||
}
|
||||
|
||||
/** An expression that pushes a `float`/`Single`. */
|
||||
class FloatLiteral extends Literal, @cil_ldc_r { }
|
||||
deprecated class FloatLiteral extends Literal, @cil_ldc_r { }
|
||||
|
||||
/** An expression that pushes a `null` value onto the stack. */
|
||||
class NullLiteral extends Literal, @cil_ldnull { }
|
||||
deprecated class NullLiteral extends Literal, @cil_ldnull { }
|
||||
|
||||
/** An expression that pushes a string onto the stack. */
|
||||
class StringLiteral extends Literal, @cil_ldstr { }
|
||||
deprecated class StringLiteral extends Literal, @cil_ldstr { }
|
||||
|
||||
/** A branch with one operand. */
|
||||
class UnaryBranch extends ConditionalBranch, @cil_unary_jump {
|
||||
deprecated class UnaryBranch extends ConditionalBranch, @cil_unary_jump {
|
||||
override int getPopCount() { result = 1 }
|
||||
|
||||
override int getPushCount() { result = 0 }
|
||||
}
|
||||
|
||||
/** A branch with two operands. */
|
||||
class BinaryBranch extends ConditionalBranch, @cil_binary_jump {
|
||||
deprecated class BinaryBranch extends ConditionalBranch, @cil_binary_jump {
|
||||
override int getPopCount() { result = 2 }
|
||||
|
||||
override int getPushCount() { result = 0 }
|
||||
}
|
||||
|
||||
/** A call. */
|
||||
class Call extends Expr, DotNet::Call, @cil_call_any {
|
||||
deprecated class Call extends Expr, DotNet::Call, @cil_call_any {
|
||||
/** Gets the method that is called. */
|
||||
override Method getTarget() { cil_access(this, result) }
|
||||
|
||||
@@ -198,24 +198,24 @@ class Call extends Expr, DotNet::Call, @cil_call_any {
|
||||
}
|
||||
|
||||
/** A tail call. */
|
||||
class TailCall extends Call {
|
||||
deprecated class TailCall extends Call {
|
||||
TailCall() { this.isTailCall() }
|
||||
|
||||
override predicate canFlowNext() { none() }
|
||||
}
|
||||
|
||||
/** A call to a static target. */
|
||||
class StaticCall extends Call {
|
||||
deprecated class StaticCall extends Call {
|
||||
StaticCall() { not this.isVirtual() }
|
||||
}
|
||||
|
||||
/** A call to a virtual target. */
|
||||
class VirtualCall extends Call {
|
||||
deprecated class VirtualCall extends Call {
|
||||
VirtualCall() { this.isVirtual() }
|
||||
}
|
||||
|
||||
/** A read of an array element. */
|
||||
class ReadArrayElement extends BinaryExpr, @cil_read_array {
|
||||
deprecated class ReadArrayElement extends BinaryExpr, @cil_read_array {
|
||||
/** Gets the array being read. */
|
||||
Expr getArray() { result = this.getOperand(1) }
|
||||
|
||||
@@ -224,14 +224,14 @@ class ReadArrayElement extends BinaryExpr, @cil_read_array {
|
||||
}
|
||||
|
||||
/** A write of an array element. */
|
||||
class WriteArrayElement extends Instruction, @cil_write_array {
|
||||
deprecated class WriteArrayElement extends Instruction, @cil_write_array {
|
||||
override int getPushCount() { result = 0 }
|
||||
|
||||
override int getPopCount() { result = 3 }
|
||||
}
|
||||
|
||||
/** A `return` statement. */
|
||||
class Return extends Instruction, @cil_ret {
|
||||
deprecated class Return extends Instruction, @cil_ret {
|
||||
/** Gets the expression being returned, if any. */
|
||||
Expr getExpr() { result = this.getOperand(0) }
|
||||
|
||||
@@ -239,7 +239,7 @@ class Return extends Instruction, @cil_ret {
|
||||
}
|
||||
|
||||
/** A `throw` statement. */
|
||||
class Throw extends Instruction, DotNet::Throw, @cil_throw_any {
|
||||
deprecated class Throw extends Instruction, DotNet::Throw, @cil_throw_any {
|
||||
override Expr getExpr() { result = this.getOperand(0) }
|
||||
|
||||
/** Gets the type of the exception being thrown. */
|
||||
@@ -249,7 +249,7 @@ class Throw extends Instruction, DotNet::Throw, @cil_throw_any {
|
||||
}
|
||||
|
||||
/** Stores a value at an address/location. */
|
||||
class StoreIndirect extends Instruction, @cil_stind {
|
||||
deprecated class StoreIndirect extends Instruction, @cil_stind {
|
||||
override int getPopCount() { result = 2 }
|
||||
|
||||
/** Gets the location to store the value at. */
|
||||
@@ -260,4 +260,4 @@ class StoreIndirect extends Instruction, @cil_stind {
|
||||
}
|
||||
|
||||
/** Loads a value from an address/location. */
|
||||
class LoadIndirect extends UnaryExpr, @cil_ldind { }
|
||||
deprecated class LoadIndirect extends UnaryExpr, @cil_ldind { }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
private import CIL
|
||||
private import semmle.code.dotnet.Variable as DotNet
|
||||
|
||||
module Opcodes {
|
||||
deprecated module Opcodes {
|
||||
/** An `ldc.i4.m1` instruction. */
|
||||
class Ldc_i4_m1 extends IntLiteral, @cil_ldc_i4_m1 {
|
||||
override string getOpcodeName() { result = "ldc.i4.m1" }
|
||||
|
||||
@@ -12,7 +12,7 @@ private import dotnet
|
||||
/**
|
||||
* An implementation of a method in an assembly.
|
||||
*/
|
||||
class MethodImplementation extends EntryPoint, @cil_method_implementation {
|
||||
deprecated class MethodImplementation extends EntryPoint, @cil_method_implementation {
|
||||
/** Gets the method of this implementation. */
|
||||
Method getMethod() { cil_method_implementation(this, result, _) }
|
||||
|
||||
@@ -66,7 +66,7 @@ class MethodImplementation extends EntryPoint, @cil_method_implementation {
|
||||
* A method, which corresponds to any callable in C#, including constructors,
|
||||
* destructors, operators, accessors and so on.
|
||||
*/
|
||||
class Method extends DotNet::Callable, Element, Member, TypeContainer, DataFlowNode,
|
||||
deprecated class Method extends DotNet::Callable, Element, Member, TypeContainer, DataFlowNode,
|
||||
CustomModifierReceiver, Parameterizable, @cil_method
|
||||
{
|
||||
/**
|
||||
@@ -191,27 +191,27 @@ class Method extends DotNet::Callable, Element, Member, TypeContainer, DataFlowN
|
||||
}
|
||||
|
||||
/** A destructor/finalizer. */
|
||||
class Destructor extends Method, DotNet::Destructor {
|
||||
deprecated class Destructor extends Method, DotNet::Destructor {
|
||||
Destructor() { this.isFinalizer() }
|
||||
}
|
||||
|
||||
/** A constructor. */
|
||||
class Constructor extends Method, DotNet::Constructor {
|
||||
deprecated class Constructor extends Method, DotNet::Constructor {
|
||||
Constructor() { this.isConstructor() }
|
||||
}
|
||||
|
||||
/** A static/class constructor. */
|
||||
class StaticConstructor extends Constructor {
|
||||
deprecated class StaticConstructor extends Constructor {
|
||||
StaticConstructor() { this.isStaticConstructor() }
|
||||
}
|
||||
|
||||
/** An instance constructor. */
|
||||
class InstanceConstructor extends Constructor {
|
||||
deprecated class InstanceConstructor extends Constructor {
|
||||
InstanceConstructor() { this.isInstanceConstructor() }
|
||||
}
|
||||
|
||||
/** A method that always returns the `this` parameter. */
|
||||
class ChainingMethod extends Method {
|
||||
deprecated class ChainingMethod extends Method {
|
||||
ChainingMethod() {
|
||||
forex(Return ret | ret = this.getImplementation().getAnInstruction() |
|
||||
ret.getExpr() instanceof ThisAccess
|
||||
@@ -220,13 +220,13 @@ class ChainingMethod extends Method {
|
||||
}
|
||||
|
||||
/** An accessor. */
|
||||
abstract class Accessor extends Method {
|
||||
abstract deprecated class Accessor extends Method {
|
||||
/** Gets the property declaring this accessor. */
|
||||
abstract Property getProperty();
|
||||
}
|
||||
|
||||
/** A getter. */
|
||||
class Getter extends Accessor {
|
||||
deprecated class Getter extends Accessor {
|
||||
Getter() { cil_getter(_, this) }
|
||||
|
||||
override Property getProperty() { cil_getter(result, this) }
|
||||
@@ -236,7 +236,7 @@ class Getter extends Accessor {
|
||||
* A method that does nothing but retrieve a field.
|
||||
* Note that this is not necessarily a property getter.
|
||||
*/
|
||||
class TrivialGetter extends Method {
|
||||
deprecated class TrivialGetter extends Method {
|
||||
TrivialGetter() {
|
||||
exists(MethodImplementation impl | impl = this.getAnImplementation() |
|
||||
impl.getInstruction(0) instanceof ThisAccess and
|
||||
@@ -252,7 +252,7 @@ class TrivialGetter extends Method {
|
||||
}
|
||||
|
||||
/** A setter. */
|
||||
class Setter extends Accessor {
|
||||
deprecated class Setter extends Accessor {
|
||||
Setter() { cil_setter(_, this) }
|
||||
|
||||
override Property getProperty() { cil_setter(result, this) }
|
||||
@@ -269,7 +269,7 @@ class Setter extends Accessor {
|
||||
* A method that does nothing but set a field.
|
||||
* This is not necessarily a property setter.
|
||||
*/
|
||||
class TrivialSetter extends Method {
|
||||
deprecated class TrivialSetter extends Method {
|
||||
TrivialSetter() {
|
||||
exists(MethodImplementation impl | impl = this.getAnImplementation() |
|
||||
impl.getInstruction(0) instanceof ThisAccess and
|
||||
@@ -285,10 +285,10 @@ class TrivialSetter extends Method {
|
||||
}
|
||||
|
||||
/** An alias for `Method` for compatibility with the C# data model. */
|
||||
class Callable = Method;
|
||||
deprecated class Callable = Method;
|
||||
|
||||
/** An operator. */
|
||||
class Operator extends Method {
|
||||
deprecated class Operator extends Method {
|
||||
Operator() { this.isOperator() }
|
||||
|
||||
/** Gets the name of the implementing method (for compatibility with C# data model). */
|
||||
|
||||
@@ -8,7 +8,7 @@ private import dotnet
|
||||
/**
|
||||
* A parameterizable entity, such as `FunctionPointerType` or `Method`.
|
||||
*/
|
||||
class Parameterizable extends DotNet::Parameterizable, Element, @cil_parameterizable {
|
||||
deprecated class Parameterizable extends DotNet::Parameterizable, Element, @cil_parameterizable {
|
||||
override Parameter getRawParameter(int n) { cil_parameter(result, this, n, _) }
|
||||
|
||||
override Parameter getParameter(int n) { cil_parameter(result, this, n, _) }
|
||||
|
||||
@@ -7,7 +7,7 @@ private import CIL
|
||||
/**
|
||||
* Provides classes for working with static single assignment (SSA) form.
|
||||
*/
|
||||
module Ssa {
|
||||
deprecated module Ssa {
|
||||
private import internal.SsaImpl as SsaImpl
|
||||
|
||||
/** An SSA definition. */
|
||||
|
||||
@@ -8,7 +8,7 @@ import CIL
|
||||
* The average number of instructions per method,
|
||||
* below which an assembly is probably a stub.
|
||||
*/
|
||||
private float stubInstructionThreshold() { result = 5.1 }
|
||||
deprecated private float stubInstructionThreshold() { result = 5.1 }
|
||||
|
||||
cached
|
||||
private module Cached {
|
||||
@@ -18,7 +18,7 @@ private module Cached {
|
||||
* Look at the average number of instructions per method.
|
||||
*/
|
||||
cached
|
||||
predicate assemblyIsStubImpl(Assembly asm) {
|
||||
deprecated predicate assemblyIsStubImpl(Assembly asm) {
|
||||
exists(int totalInstructions, int totalImplementations |
|
||||
totalInstructions = count(Instruction i | i.getImplementation().getLocation() = asm) and
|
||||
totalImplementations =
|
||||
@@ -28,7 +28,7 @@ private module Cached {
|
||||
}
|
||||
|
||||
cached
|
||||
predicate bestImplementation(MethodImplementation mi) {
|
||||
deprecated predicate bestImplementation(MethodImplementation mi) {
|
||||
exists(Assembly asm |
|
||||
asm = mi.getLocation() and
|
||||
(assemblyIsStubImpl(asm) implies asm.getFile().extractedQlTest()) and
|
||||
@@ -45,13 +45,13 @@ private module Cached {
|
||||
|
||||
private import Cached
|
||||
|
||||
predicate assemblyIsStub = assemblyIsStubImpl/1;
|
||||
deprecated predicate assemblyIsStub = assemblyIsStubImpl/1;
|
||||
|
||||
/**
|
||||
* A method implementation that is the "best" one for a particular method,
|
||||
* if there are several potential implementations to choose between, and
|
||||
* excludes implementations that are probably from stub/reference assemblies.
|
||||
*/
|
||||
class BestImplementation extends MethodImplementation {
|
||||
deprecated class BestImplementation extends MethodImplementation {
|
||||
BestImplementation() { bestImplementation(this) }
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ private import semmle.code.csharp.commons.QualifiedName
|
||||
*
|
||||
* Either a type (`Type`), a method(`Method`), or a namespace (`Namespace`).
|
||||
*/
|
||||
class TypeContainer extends DotNet::NamedElement, @cil_type_container {
|
||||
deprecated class TypeContainer extends DotNet::NamedElement, @cil_type_container {
|
||||
/** Gets the parent of this type container, if any. */
|
||||
TypeContainer getParent() { none() }
|
||||
|
||||
@@ -19,7 +19,7 @@ class TypeContainer extends DotNet::NamedElement, @cil_type_container {
|
||||
}
|
||||
|
||||
/** A namespace. */
|
||||
class Namespace extends DotNet::Namespace, TypeContainer, @namespace {
|
||||
deprecated class Namespace extends DotNet::Namespace, TypeContainer, @namespace {
|
||||
override string toString() { result = this.getFullName() }
|
||||
|
||||
override Namespace getParent() { result = this.getParentNamespace() }
|
||||
@@ -32,7 +32,7 @@ class Namespace extends DotNet::Namespace, TypeContainer, @namespace {
|
||||
/**
|
||||
* A type.
|
||||
*/
|
||||
class Type extends DotNet::Type, Declaration, TypeContainer, @cil_type {
|
||||
deprecated class Type extends DotNet::Type, Declaration, TypeContainer, @cil_type {
|
||||
override TypeContainer getParent() { cil_type(this, _, _, result, _) }
|
||||
|
||||
override string getName() { cil_type(this, result, _, _, _) }
|
||||
|
||||
@@ -6,7 +6,7 @@ private import CIL
|
||||
private import dotnet
|
||||
|
||||
/** A type parameter. */
|
||||
class TypeParameter extends DotNet::TypeParameter, Type, @cil_typeparameter {
|
||||
deprecated class TypeParameter extends DotNet::TypeParameter, Type, @cil_typeparameter {
|
||||
override int getIndex() { cil_type_parameter(_, result, this) }
|
||||
|
||||
/** Gets the generic type/method declaring this type parameter. */
|
||||
@@ -33,7 +33,7 @@ class TypeParameter extends DotNet::TypeParameter, Type, @cil_typeparameter {
|
||||
}
|
||||
|
||||
/** A value or reference type. */
|
||||
class ValueOrRefType extends DotNet::ValueOrRefType, Type, @cil_valueorreftype {
|
||||
deprecated class ValueOrRefType extends DotNet::ValueOrRefType, Type, @cil_valueorreftype {
|
||||
override ValueOrRefType getDeclaringType() { result = this.getParent() }
|
||||
|
||||
override string getUndecoratedName() { cil_type(this, result, _, _, _) }
|
||||
@@ -44,7 +44,7 @@ class ValueOrRefType extends DotNet::ValueOrRefType, Type, @cil_valueorreftype {
|
||||
}
|
||||
|
||||
/** An `enum`. */
|
||||
class Enum extends ValueOrRefType {
|
||||
deprecated class Enum extends ValueOrRefType {
|
||||
Enum() { this.isEnum() }
|
||||
|
||||
override IntegralType getUnderlyingType() {
|
||||
@@ -56,17 +56,17 @@ class Enum extends ValueOrRefType {
|
||||
}
|
||||
|
||||
/** A `class`. */
|
||||
class Class extends ValueOrRefType {
|
||||
deprecated class Class extends ValueOrRefType {
|
||||
Class() { this.isClass() }
|
||||
}
|
||||
|
||||
/** An `interface`. */
|
||||
class Interface extends ValueOrRefType {
|
||||
deprecated class Interface extends ValueOrRefType {
|
||||
Interface() { this.isInterface() }
|
||||
}
|
||||
|
||||
/** An array. */
|
||||
class ArrayType extends DotNet::ArrayType, Type, @cil_array_type {
|
||||
deprecated class ArrayType extends DotNet::ArrayType, Type, @cil_array_type {
|
||||
override Type getElementType() { cil_array_type(this, result, _) }
|
||||
|
||||
/** Gets the rank of this array. */
|
||||
@@ -80,7 +80,7 @@ class ArrayType extends DotNet::ArrayType, Type, @cil_array_type {
|
||||
}
|
||||
|
||||
/** A pointer type. */
|
||||
class PointerType extends DotNet::PointerType, PrimitiveType, @cil_pointer_type {
|
||||
deprecated class PointerType extends DotNet::PointerType, PrimitiveType, @cil_pointer_type {
|
||||
override Type getReferentType() { cil_pointer_type(this, result) }
|
||||
|
||||
override IntType getUnderlyingType() { any() }
|
||||
@@ -95,31 +95,31 @@ class PointerType extends DotNet::PointerType, PrimitiveType, @cil_pointer_type
|
||||
}
|
||||
|
||||
/** A primitive type, built into the runtime. */
|
||||
abstract class PrimitiveType extends Type { }
|
||||
abstract deprecated class PrimitiveType extends Type { }
|
||||
|
||||
/**
|
||||
* A primitive numeric type.
|
||||
* Either an integral type (`IntegralType`) or a floating point type (`FloatingPointType`).
|
||||
*/
|
||||
abstract class NumericType extends PrimitiveType, ValueOrRefType { }
|
||||
abstract deprecated class NumericType extends PrimitiveType, ValueOrRefType { }
|
||||
|
||||
/** A floating point type. Either single precision (`FloatType`) or double precision (`DoubleType`). */
|
||||
abstract class FloatingPointType extends NumericType { }
|
||||
abstract deprecated class FloatingPointType extends NumericType { }
|
||||
|
||||
/**
|
||||
* An integral numeric type. Either a signed integral type (`SignedIntegralType`)
|
||||
* or an unsigned integral type (`UnsignedIntegralType`).
|
||||
*/
|
||||
abstract class IntegralType extends NumericType { }
|
||||
abstract deprecated class IntegralType extends NumericType { }
|
||||
|
||||
/** A signed integral type. */
|
||||
abstract class SignedIntegralType extends IntegralType { }
|
||||
abstract deprecated class SignedIntegralType extends IntegralType { }
|
||||
|
||||
/** An unsigned integral type. */
|
||||
abstract class UnsignedIntegralType extends IntegralType { }
|
||||
abstract deprecated class UnsignedIntegralType extends IntegralType { }
|
||||
|
||||
/** The `void` type, `System.Void`. */
|
||||
class VoidType extends PrimitiveType {
|
||||
deprecated class VoidType extends PrimitiveType {
|
||||
VoidType() { this.isSystemType("Void") }
|
||||
|
||||
override string toString() { result = "void" }
|
||||
@@ -128,7 +128,7 @@ class VoidType extends PrimitiveType {
|
||||
}
|
||||
|
||||
/** The type `System.Int32`. */
|
||||
class IntType extends SignedIntegralType {
|
||||
deprecated class IntType extends SignedIntegralType {
|
||||
IntType() { this.isSystemType("Int32") }
|
||||
|
||||
override string toStringWithTypes() { result = "int" }
|
||||
@@ -139,21 +139,21 @@ class IntType extends SignedIntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.IntPtr`. */
|
||||
class IntPtrType extends PrimitiveType {
|
||||
deprecated class IntPtrType extends PrimitiveType {
|
||||
IntPtrType() { this.isSystemType("IntPtr") }
|
||||
|
||||
override IntType getUnderlyingType() { any() }
|
||||
}
|
||||
|
||||
/** The type `System.UIntPtr`. */
|
||||
class UIntPtrType extends PrimitiveType {
|
||||
deprecated class UIntPtrType extends PrimitiveType {
|
||||
UIntPtrType() { this.isSystemType("UIntPtr") }
|
||||
|
||||
override IntType getUnderlyingType() { any() }
|
||||
}
|
||||
|
||||
/** The type `System.UInt32`. */
|
||||
class UIntType extends UnsignedIntegralType {
|
||||
deprecated class UIntType extends UnsignedIntegralType {
|
||||
UIntType() { this.isSystemType("UInt32") }
|
||||
|
||||
override string toStringWithTypes() { result = "uint" }
|
||||
@@ -164,7 +164,7 @@ class UIntType extends UnsignedIntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.SByte`. */
|
||||
class SByteType extends SignedIntegralType {
|
||||
deprecated class SByteType extends SignedIntegralType {
|
||||
SByteType() { this.isSystemType("SByte") }
|
||||
|
||||
override string toStringWithTypes() { result = "sbyte" }
|
||||
@@ -173,7 +173,7 @@ class SByteType extends SignedIntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.Byte`. */
|
||||
class ByteType extends UnsignedIntegralType {
|
||||
deprecated class ByteType extends UnsignedIntegralType {
|
||||
ByteType() { this.isSystemType("Byte") }
|
||||
|
||||
override string toStringWithTypes() { result = "byte" }
|
||||
@@ -184,7 +184,7 @@ class ByteType extends UnsignedIntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.Int16`. */
|
||||
class ShortType extends SignedIntegralType {
|
||||
deprecated class ShortType extends SignedIntegralType {
|
||||
ShortType() { this.isSystemType("Int16") }
|
||||
|
||||
override string toStringWithTypes() { result = "short" }
|
||||
@@ -193,7 +193,7 @@ class ShortType extends SignedIntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.UInt16`. */
|
||||
class UShortType extends UnsignedIntegralType {
|
||||
deprecated class UShortType extends UnsignedIntegralType {
|
||||
UShortType() { this.isSystemType("UInt16") }
|
||||
|
||||
override string toStringWithTypes() { result = "ushort" }
|
||||
@@ -204,7 +204,7 @@ class UShortType extends UnsignedIntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.Int64`. */
|
||||
class LongType extends SignedIntegralType {
|
||||
deprecated class LongType extends SignedIntegralType {
|
||||
LongType() { this.isSystemType("Int64") }
|
||||
|
||||
override string toStringWithTypes() { result = "long" }
|
||||
@@ -213,7 +213,7 @@ class LongType extends SignedIntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.UInt64`. */
|
||||
class ULongType extends UnsignedIntegralType {
|
||||
deprecated class ULongType extends UnsignedIntegralType {
|
||||
ULongType() { this.isSystemType("UInt64") }
|
||||
|
||||
override string toStringWithTypes() { result = "ulong" }
|
||||
@@ -224,7 +224,7 @@ class ULongType extends UnsignedIntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.Decimal`. */
|
||||
class DecimalType extends SignedIntegralType {
|
||||
deprecated class DecimalType extends SignedIntegralType {
|
||||
DecimalType() { this.isSystemType("Decimal") }
|
||||
|
||||
override string toStringWithTypes() { result = "decimal" }
|
||||
@@ -233,21 +233,21 @@ class DecimalType extends SignedIntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.String`. */
|
||||
class StringType extends PrimitiveType, ValueOrRefType {
|
||||
deprecated class StringType extends PrimitiveType, ValueOrRefType {
|
||||
StringType() { this.isSystemType("String") }
|
||||
|
||||
override string toStringWithTypes() { result = "string" }
|
||||
}
|
||||
|
||||
/** The type `System.Object`. */
|
||||
class ObjectType extends ValueOrRefType {
|
||||
deprecated class ObjectType extends ValueOrRefType {
|
||||
ObjectType() { this.isSystemType("Object") }
|
||||
|
||||
override string toStringWithTypes() { result = "object" }
|
||||
}
|
||||
|
||||
/** The type `System.Boolean`. */
|
||||
class BoolType extends PrimitiveType, ValueOrRefType {
|
||||
deprecated class BoolType extends PrimitiveType, ValueOrRefType {
|
||||
BoolType() { this.isSystemType("Boolean") }
|
||||
|
||||
override string toStringWithTypes() { result = "bool" }
|
||||
@@ -256,7 +256,7 @@ class BoolType extends PrimitiveType, ValueOrRefType {
|
||||
}
|
||||
|
||||
/** The type `System.Double`. */
|
||||
class DoubleType extends FloatingPointType {
|
||||
deprecated class DoubleType extends FloatingPointType {
|
||||
DoubleType() { this.isSystemType("Double") }
|
||||
|
||||
override string toStringWithTypes() { result = "double" }
|
||||
@@ -265,7 +265,7 @@ class DoubleType extends FloatingPointType {
|
||||
}
|
||||
|
||||
/** The type `System.Single`. */
|
||||
class FloatType extends FloatingPointType {
|
||||
deprecated class FloatType extends FloatingPointType {
|
||||
FloatType() { this.isSystemType("Single") }
|
||||
|
||||
override string toStringWithTypes() { result = "float" }
|
||||
@@ -274,7 +274,7 @@ class FloatType extends FloatingPointType {
|
||||
}
|
||||
|
||||
/** The type `System.Char`. */
|
||||
class CharType extends IntegralType {
|
||||
deprecated class CharType extends IntegralType {
|
||||
CharType() { this.isSystemType("Char") }
|
||||
|
||||
override string toStringWithTypes() { result = "char" }
|
||||
@@ -285,7 +285,7 @@ class CharType extends IntegralType {
|
||||
}
|
||||
|
||||
/** The type `System.Type`. */
|
||||
class SystemType extends ValueOrRefType {
|
||||
deprecated class SystemType extends ValueOrRefType {
|
||||
SystemType() { this.isSystemType("Type") }
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ class SystemType extends ValueOrRefType {
|
||||
* delegate*<int, void>
|
||||
* ```
|
||||
*/
|
||||
class FunctionPointerType extends Type, CustomModifierReceiver, Parameterizable,
|
||||
deprecated class FunctionPointerType extends Type, CustomModifierReceiver, Parameterizable,
|
||||
@cil_function_pointer_type
|
||||
{
|
||||
/** Gets the return type of this function pointer. */
|
||||
|
||||
@@ -6,7 +6,7 @@ private import CIL
|
||||
private import dotnet
|
||||
|
||||
/** A variable. Either a stack variable (`StackVariable`) or a field (`Field`). */
|
||||
class Variable extends DotNet::Variable, Declaration, DataFlowNode, @cil_variable {
|
||||
deprecated class Variable extends DotNet::Variable, Declaration, DataFlowNode, @cil_variable {
|
||||
/** Gets the type of this variable. */
|
||||
override Type getType() { none() }
|
||||
|
||||
@@ -28,7 +28,7 @@ class Variable extends DotNet::Variable, Declaration, DataFlowNode, @cil_variabl
|
||||
}
|
||||
|
||||
/** A stack variable. Either a local variable (`LocalVariable`) or a parameter (`Parameter`). */
|
||||
class StackVariable extends Variable, @cil_stack_variable {
|
||||
deprecated class StackVariable extends Variable, @cil_stack_variable {
|
||||
deprecated override predicate hasQualifiedName(string qualifier, string name) { none() }
|
||||
|
||||
override predicate hasFullyQualifiedName(string qualifier, string name) { none() }
|
||||
@@ -39,7 +39,7 @@ class StackVariable extends Variable, @cil_stack_variable {
|
||||
*
|
||||
* Each method in CIL has a number of typed local variables, in addition to the evaluation stack.
|
||||
*/
|
||||
class LocalVariable extends StackVariable, @cil_local_variable {
|
||||
deprecated class LocalVariable extends StackVariable, @cil_local_variable {
|
||||
override string toString() {
|
||||
result =
|
||||
"Local variable " + this.getIndex() + " of method " +
|
||||
@@ -60,7 +60,7 @@ class LocalVariable extends StackVariable, @cil_local_variable {
|
||||
}
|
||||
|
||||
/** A parameter of a `Method` or `FunctionPointerType`. */
|
||||
class Parameter extends DotNet::Parameter, CustomModifierReceiver, @cil_parameter {
|
||||
deprecated class Parameter extends DotNet::Parameter, CustomModifierReceiver, @cil_parameter {
|
||||
override Parameterizable getDeclaringElement() { cil_parameter(this, result, _, _) }
|
||||
|
||||
/** Gets the index of this parameter. */
|
||||
@@ -107,7 +107,7 @@ class Parameter extends DotNet::Parameter, CustomModifierReceiver, @cil_paramete
|
||||
}
|
||||
|
||||
/** A method parameter. */
|
||||
class MethodParameter extends Parameter, StackVariable {
|
||||
deprecated class MethodParameter extends Parameter, StackVariable {
|
||||
/** Gets the method declaring this parameter. */
|
||||
override Method getMethod() { this = result.getARawParameter() }
|
||||
|
||||
@@ -132,7 +132,7 @@ class MethodParameter extends Parameter, StackVariable {
|
||||
}
|
||||
|
||||
/** A parameter corresponding to `this`. */
|
||||
class ThisParameter extends MethodParameter {
|
||||
deprecated class ThisParameter extends MethodParameter {
|
||||
ThisParameter() {
|
||||
not this.getMethod().isStatic() and
|
||||
this.getIndex() = 0
|
||||
@@ -140,7 +140,7 @@ class ThisParameter extends MethodParameter {
|
||||
}
|
||||
|
||||
/** A field. */
|
||||
class Field extends DotNet::Field, Variable, Member, CustomModifierReceiver, @cil_field {
|
||||
deprecated class Field extends DotNet::Field, Variable, Member, CustomModifierReceiver, @cil_field {
|
||||
override string toString() { result = this.getName() }
|
||||
|
||||
override string toStringWithTypes() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
private import cil
|
||||
private import codeql.ssa.Ssa as SsaImplCommon
|
||||
|
||||
private module SsaInput implements SsaImplCommon::InputSig<CIL::Location> {
|
||||
deprecated private module SsaInput implements SsaImplCommon::InputSig<CIL::Location> {
|
||||
class BasicBlock = CIL::BasicBlock;
|
||||
|
||||
BasicBlock getImmediateBasicBlockDominator(BasicBlock bb) { result = bb.getImmediateDominator() }
|
||||
@@ -29,17 +29,17 @@ private module SsaInput implements SsaImplCommon::InputSig<CIL::Location> {
|
||||
}
|
||||
}
|
||||
|
||||
import SsaImplCommon::Make<CIL::Location, SsaInput>
|
||||
deprecated import SsaImplCommon::Make<CIL::Location, SsaInput>
|
||||
|
||||
cached
|
||||
private module Cached {
|
||||
private import CIL
|
||||
|
||||
cached
|
||||
predicate forceCachingInSameStage() { any() }
|
||||
deprecated predicate forceCachingInSameStage() { any() }
|
||||
|
||||
cached
|
||||
ReadAccess getARead(Definition def) {
|
||||
deprecated ReadAccess getARead(Definition def) {
|
||||
exists(BasicBlock bb, int i |
|
||||
ssaDefReachesRead(_, def, bb, i) and
|
||||
result = bb.getNode(i)
|
||||
@@ -47,7 +47,7 @@ private module Cached {
|
||||
}
|
||||
|
||||
cached
|
||||
ReadAccess getAFirstReadExt(DefinitionExt def) {
|
||||
deprecated ReadAccess getAFirstReadExt(DefinitionExt def) {
|
||||
exists(BasicBlock bb1, int i1, BasicBlock bb2, int i2 |
|
||||
def.definesAt(_, bb1, i1, _) and
|
||||
adjacentDefReadExt(def, _, bb1, i1, bb2, i2) and
|
||||
@@ -56,7 +56,7 @@ private module Cached {
|
||||
}
|
||||
|
||||
cached
|
||||
predicate hasAdjacentReadsExt(DefinitionExt def, ReadAccess first, ReadAccess second) {
|
||||
deprecated predicate hasAdjacentReadsExt(DefinitionExt def, ReadAccess first, ReadAccess second) {
|
||||
exists(BasicBlock bb1, int i1, BasicBlock bb2, int i2 |
|
||||
first = bb1.getNode(i1) and
|
||||
adjacentDefReadExt(def, _, bb1, i1, bb2, i2) and
|
||||
@@ -65,10 +65,12 @@ private module Cached {
|
||||
}
|
||||
|
||||
cached
|
||||
Definition getAPhiInput(PhiNode phi) { phiHasInputFromBlock(phi, result, _) }
|
||||
deprecated Definition getAPhiInput(PhiNode phi) { phiHasInputFromBlock(phi, result, _) }
|
||||
|
||||
cached
|
||||
predicate lastRefBeforeRedefExt(DefinitionExt def, BasicBlock bb, int i, DefinitionExt next) {
|
||||
deprecated predicate lastRefBeforeRedefExt(
|
||||
DefinitionExt def, BasicBlock bb, int i, DefinitionExt next
|
||||
) {
|
||||
lastRefRedefExt(def, _, bb, i, next)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import Stmt
|
||||
import Type
|
||||
import exprs.Call
|
||||
private import commons.QualifiedName
|
||||
private import dotnet
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import semmle.code.csharp.metrics.Complexity
|
||||
private import TypeRef
|
||||
@@ -21,8 +20,73 @@ private import TypeRef
|
||||
* an anonymous function (`AnonymousFunctionExpr`), or a local function
|
||||
* (`LocalFunction`).
|
||||
*/
|
||||
class Callable extends DotNet::Callable, Parameterizable, ExprOrStmtParent, @callable {
|
||||
override Type getReturnType() { none() }
|
||||
class Callable extends Parameterizable, ExprOrStmtParent, @callable {
|
||||
pragma[noinline]
|
||||
deprecated private string getDeclaringTypeLabel() { result = this.getDeclaringType().getLabel() }
|
||||
|
||||
pragma[noinline]
|
||||
deprecated private string getParameterTypeLabelNonGeneric(int p) {
|
||||
not this instanceof Generic and
|
||||
result = this.getParameter(p).getType().getLabel()
|
||||
}
|
||||
|
||||
language[monotonicAggregates]
|
||||
pragma[nomagic]
|
||||
deprecated private string getMethodParamListNonGeneric() {
|
||||
result =
|
||||
concat(int p |
|
||||
p in [0 .. this.getNumberOfParameters() - 1]
|
||||
|
|
||||
this.getParameterTypeLabelNonGeneric(p), "," order by p
|
||||
)
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
deprecated private string getParameterTypeLabelGeneric(int p) {
|
||||
this instanceof Generic and
|
||||
result = this.getParameter(p).getType().getLabel()
|
||||
}
|
||||
|
||||
language[monotonicAggregates]
|
||||
pragma[nomagic]
|
||||
deprecated private string getMethodParamListGeneric() {
|
||||
result =
|
||||
concat(int p |
|
||||
p in [0 .. this.getNumberOfParameters() - 1]
|
||||
|
|
||||
this.getParameterTypeLabelGeneric(p), "," order by p
|
||||
)
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
deprecated private string getLabelNonGeneric() {
|
||||
not this instanceof Generic and
|
||||
result =
|
||||
this.getReturnTypeLabel() + " " + this.getDeclaringTypeLabel() + "." +
|
||||
this.getUndecoratedName() + "(" + this.getMethodParamListNonGeneric() + ")"
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
deprecated private string getLabelGeneric() {
|
||||
result =
|
||||
this.getReturnTypeLabel() + " " + this.getDeclaringTypeLabel() + "." +
|
||||
this.getUndecoratedName() + getGenericsLabel(this) + "(" + this.getMethodParamListGeneric() +
|
||||
")"
|
||||
}
|
||||
|
||||
deprecated final override string getLabel() {
|
||||
result = this.getLabelNonGeneric() or
|
||||
result = this.getLabelGeneric()
|
||||
}
|
||||
|
||||
deprecated private string getReturnTypeLabel() {
|
||||
result = this.getReturnType().getLabel()
|
||||
or
|
||||
not exists(this.getReturnType()) and result = "System.Void"
|
||||
}
|
||||
|
||||
/** Gets the return type of this callable. */
|
||||
Type getReturnType() { none() }
|
||||
|
||||
/** Gets the annotated return type of this callable. */
|
||||
final AnnotatedType getAnnotatedReturnType() { result.appliesTo(this) }
|
||||
@@ -65,7 +129,8 @@ class Callable extends DotNet::Callable, Parameterizable, ExprOrStmtParent, @cal
|
||||
result = this.getExpressionBody()
|
||||
}
|
||||
|
||||
override predicate hasBody() { exists(this.getBody()) }
|
||||
/** Holds if this callable has a body or an implementation. */
|
||||
predicate hasBody() { exists(this.getBody()) }
|
||||
|
||||
/**
|
||||
* Holds if this callable has a non-empty body. That is, either it has
|
||||
@@ -196,7 +261,8 @@ class Callable extends DotNet::Callable, Parameterizable, ExprOrStmtParent, @cal
|
||||
)
|
||||
}
|
||||
|
||||
override predicate canReturn(DotNet::Expr e) {
|
||||
/** Holds if this callable can return expression `e`. */
|
||||
predicate canReturn(Expr e) {
|
||||
exists(ReturnStmt ret | ret.getEnclosingCallable() = this | e = ret.getExpr())
|
||||
or
|
||||
e = this.getExpressionBody() and
|
||||
@@ -218,8 +284,6 @@ class Callable extends DotNet::Callable, Parameterizable, ExprOrStmtParent, @cal
|
||||
|
||||
/** Gets a `Call` that has this callable as a target. */
|
||||
Call getACall() { this = result.getTarget() }
|
||||
|
||||
override Parameter getAParameter() { result = Parameterizable.super.getAParameter() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,7 +389,7 @@ class ExtensionMethod extends Method {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Constructor extends DotNet::Constructor, Callable, Member, Attributable, @constructor {
|
||||
class Constructor extends Callable, Member, Attributable, @constructor {
|
||||
override string getName() { constructors(this, result, _, _) }
|
||||
|
||||
override Type getReturnType() {
|
||||
@@ -435,7 +499,7 @@ class PrimaryConstructor extends Constructor {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Destructor extends DotNet::Destructor, Callable, Member, Attributable, @destructor {
|
||||
class Destructor extends Callable, Member, Attributable, @destructor {
|
||||
override string getName() { destructors(this, result, _, _) }
|
||||
|
||||
override Type getReturnType() {
|
||||
@@ -497,10 +561,33 @@ class Operator extends Callable, Member, Attributable, Overridable, @operator {
|
||||
override Parameter getRawParameter(int i) { result = this.getParameter(i) }
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private ValueOrRefType getARecordBaseType(ValueOrRefType t) {
|
||||
exists(Callable c |
|
||||
c.hasName("<Clone>$") and
|
||||
c.getNumberOfParameters() = 0 and
|
||||
t = c.getDeclaringType() and
|
||||
result = t
|
||||
)
|
||||
or
|
||||
result = getARecordBaseType(t).getABaseType()
|
||||
}
|
||||
|
||||
/** A clone method on a record. */
|
||||
class RecordCloneMethod extends Method, DotNet::RecordCloneCallable {
|
||||
override Constructor getConstructor() {
|
||||
result = DotNet::RecordCloneCallable.super.getConstructor()
|
||||
class RecordCloneMethod extends Method {
|
||||
RecordCloneMethod() {
|
||||
this.hasName("<Clone>$") and
|
||||
this.getNumberOfParameters() = 0 and
|
||||
this.getReturnType() = getARecordBaseType(this.getDeclaringType()) and
|
||||
this.isPublic() and
|
||||
not this.isStatic()
|
||||
}
|
||||
|
||||
/** Gets the constructor that this clone method calls. */
|
||||
Constructor getConstructor() {
|
||||
result.getDeclaringType() = this.getDeclaringType() and
|
||||
result.getNumberOfParameters() = 1 and
|
||||
result.getParameter(0).getType() = this.getDeclaringType()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import Location
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import dotnet
|
||||
private import commons.QualifiedName
|
||||
|
||||
/**
|
||||
@@ -14,18 +13,64 @@ private import commons.QualifiedName
|
||||
* (`NamespaceDeclaration`), a `using` directive (`UsingDirective`), or type
|
||||
* parameter constraints (`TypeParameterConstraints`).
|
||||
*/
|
||||
class Element extends DotNet::Element, @element {
|
||||
override string toStringWithTypes() { result = this.toString() }
|
||||
class Element extends @element {
|
||||
/** Gets a textual representation of this element. */
|
||||
cached
|
||||
string toString() { none() }
|
||||
|
||||
/** Gets the file containing this element. */
|
||||
final File getFile() { result = this.getLocation().getFile() }
|
||||
|
||||
/** Holds if this element is from source code. */
|
||||
predicate fromSource() { this.getFile().fromSource() }
|
||||
|
||||
/** Holds if this element is from an assembly. */
|
||||
predicate fromLibrary() { this.getFile().fromLibrary() }
|
||||
|
||||
/**
|
||||
* Gets the "language" of this program element, as defined by the extension of the filename.
|
||||
* For example, C# has language "cs", and Visual Basic has language "vb".
|
||||
*/
|
||||
deprecated final string getLanguage() { result = this.getLocation().getFile().getExtension() }
|
||||
|
||||
/**
|
||||
* Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.
|
||||
*
|
||||
* If no primary class can be determined, the result is `"???"`.
|
||||
*/
|
||||
final string getPrimaryQlClasses() {
|
||||
result = strictconcat(this.getAPrimaryQlClass(), ",")
|
||||
or
|
||||
not exists(this.getAPrimaryQlClass()) and
|
||||
result = "???"
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of a primary CodeQL class to which this element belongs.
|
||||
*
|
||||
* For most elements, this is simply the most precise syntactic category to
|
||||
* which they belong; for example, `AddExpr` is a primary class, but
|
||||
* `BinaryOperation` is not.
|
||||
*
|
||||
* If no primary classes match, this predicate has no result. If multiple
|
||||
* primary classes match, this predicate can have multiple results.
|
||||
*
|
||||
* See also `getPrimaryQlClasses`, which is better to use in most cases.
|
||||
*/
|
||||
string getAPrimaryQlClass() { none() }
|
||||
|
||||
/** Gets the full textual representation of this element, including type information. */
|
||||
string toStringWithTypes() { result = this.toString() }
|
||||
|
||||
/**
|
||||
* Gets the location of this element. Where an element has locations in
|
||||
* source and assemblies, choose the source location. If there are multiple
|
||||
* assembly locations, choose only one.
|
||||
*/
|
||||
final override Location getLocation() { result = bestLocation(this) }
|
||||
final Location getLocation() { result = bestLocation(this) }
|
||||
|
||||
/** Gets a location of this element, including sources and assemblies. */
|
||||
override Location getALocation() { none() }
|
||||
Location getALocation() { none() }
|
||||
|
||||
/** Gets the parent of this element, if any. */
|
||||
Element getParent() { result.getAChild() = this }
|
||||
@@ -46,3 +91,96 @@ class Element extends DotNet::Element, @element {
|
||||
*/
|
||||
int getIndex() { exists(Element parent | parent.getChild(result) = this) }
|
||||
}
|
||||
|
||||
/** An element that has a name. */
|
||||
class NamedElement extends Element, @named_element {
|
||||
/** Gets the name of this element. */
|
||||
cached
|
||||
string getName() { none() }
|
||||
|
||||
/** Holds if this element has name 'name'. */
|
||||
final predicate hasName(string name) { name = this.getName() }
|
||||
|
||||
/**
|
||||
* Gets the fully qualified name of this element, for example the
|
||||
* fully qualified name of `M` on line 3 is `N.C.M` in
|
||||
*
|
||||
* ```csharp
|
||||
* namespace N {
|
||||
* class C {
|
||||
* void M(int i, string s) { }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
cached
|
||||
deprecated final string getQualifiedName() {
|
||||
exists(string qualifier, string name | this.hasQualifiedName(qualifier, name) |
|
||||
if qualifier = "" then result = name else result = qualifier + "." + name
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fully qualified name of this element, for example the
|
||||
* fully qualified name of `M` on line 3 is `N.C.M` in
|
||||
*
|
||||
* ```csharp
|
||||
* namespace N {
|
||||
* class C {
|
||||
* void M(int i, string s) { }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Unbound generic types, such as `IList<T>`, are represented as
|
||||
* ``System.Collections.Generic.IList`1``.
|
||||
*/
|
||||
cached
|
||||
final string getFullyQualifiedName() {
|
||||
exists(string qualifier, string name | this.hasFullyQualifiedName(qualifier, name) |
|
||||
if qualifier = "" then result = name else result = qualifier + "." + name
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: Use `hasFullyQualifiedName` instead.
|
||||
*
|
||||
* Holds if this element has the qualified name `qualifier`.`name`.
|
||||
*/
|
||||
cached
|
||||
deprecated predicate hasQualifiedName(string qualifier, string name) {
|
||||
qualifier = "" and name = this.getName()
|
||||
}
|
||||
|
||||
/** Holds if this element has the fully qualified name `qualifier`.`name`. */
|
||||
cached
|
||||
predicate hasFullyQualifiedName(string qualifier, string name) {
|
||||
qualifier = "" and name = this.getName()
|
||||
}
|
||||
|
||||
/** Gets a unique string label for this element. */
|
||||
cached
|
||||
deprecated string getLabel() { none() }
|
||||
|
||||
/** Holds if `other` has the same metadata handle in the same assembly. */
|
||||
deprecated predicate matchesHandle(NamedElement other) {
|
||||
exists(Assembly asm, int handle |
|
||||
metadata_handle(this, asm, handle) and
|
||||
metadata_handle(other, asm, handle)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this element was compiled from source code that is also present in the
|
||||
* database. That is, this element corresponds to another element from source.
|
||||
*/
|
||||
deprecated predicate compiledFromSource() {
|
||||
not this.fromSource() and
|
||||
exists(NamedElement other | other != this |
|
||||
this.matchesHandle(other) and
|
||||
other.fromSource()
|
||||
)
|
||||
}
|
||||
|
||||
override string toString() { result = this.getName() }
|
||||
}
|
||||
|
||||
@@ -16,14 +16,13 @@
|
||||
import Location
|
||||
import Namespace
|
||||
private import commons.QualifiedName
|
||||
private import dotnet
|
||||
private import TypeRef
|
||||
|
||||
/**
|
||||
* A generic declaration. Either an unbound generic (`UnboundGeneric`) or a
|
||||
* constructed generic (`ConstructedGeneric`).
|
||||
*/
|
||||
class Generic extends DotNet::Generic, Declaration, @generic {
|
||||
class Generic extends Declaration, @generic {
|
||||
Generic() {
|
||||
type_parameters(_, _, this, _) or
|
||||
type_arguments(_, _, this) or
|
||||
@@ -37,16 +36,23 @@ class Generic extends DotNet::Generic, Declaration, @generic {
|
||||
* Either an unbound generic type (`UnboundGenericType`) or an unbound generic method
|
||||
* (`UnboundGenericMethod`).
|
||||
*/
|
||||
class UnboundGeneric extends DotNet::UnboundGeneric, Generic {
|
||||
class UnboundGeneric extends Generic {
|
||||
UnboundGeneric() { type_parameters(_, _, this, _) }
|
||||
|
||||
final override TypeParameter getTypeParameter(int n) { type_parameters(result, n, this, _) }
|
||||
/** Gets the `i`th type parameter, if any. */
|
||||
final TypeParameter getTypeParameter(int n) { type_parameters(result, n, this, _) }
|
||||
|
||||
override ConstructedGeneric getAConstructedGeneric() { result.getUnboundGeneric() = this }
|
||||
/** Gets a type parameter. */
|
||||
TypeParameter getATypeParameter() { result = this.getTypeParameter(_) }
|
||||
|
||||
override TypeParameter getATypeParameter() {
|
||||
result = DotNet::UnboundGeneric.super.getATypeParameter()
|
||||
}
|
||||
/**
|
||||
* Gets one of the constructed versions of this declaration,
|
||||
* which has been bound to a specific set of types.
|
||||
*/
|
||||
ConstructedGeneric getAConstructedGeneric() { result.getUnboundGeneric() = this }
|
||||
|
||||
/** Gets the total number of type parameters. */
|
||||
int getNumberOfTypeParameters() { result = count(int i | exists(this.getTypeParameter(i))) }
|
||||
}
|
||||
|
||||
/** Gets the type parameters as a comma-separated string. */
|
||||
@@ -67,25 +73,61 @@ private string getTypeParameterBacktick(UnboundGeneric ug) {
|
||||
* Either a constructed generic type (`ConstructedType`) or a constructed
|
||||
* generic method (`ConstructedMethod`).
|
||||
*/
|
||||
class ConstructedGeneric extends DotNet::ConstructedGeneric, Generic {
|
||||
class ConstructedGeneric extends Generic {
|
||||
ConstructedGeneric() {
|
||||
type_arguments(_, _, this)
|
||||
or
|
||||
nullable_underlying_type(this, _)
|
||||
}
|
||||
|
||||
override UnboundGeneric getUnboundGeneric() { constructed_generic(this, result) }
|
||||
/**
|
||||
* Gets the unbound generic declaration from which this declaration was
|
||||
* constructed.
|
||||
*/
|
||||
UnboundGeneric getUnboundGeneric() { constructed_generic(this, result) }
|
||||
|
||||
override UnboundGeneric getUnboundDeclaration() {
|
||||
result = this.getUnboundGeneric().getUnboundDeclaration()
|
||||
}
|
||||
|
||||
override Type getTypeArgument(int i) { none() }
|
||||
/** Gets the `i`th type argument, if any. */
|
||||
Type getTypeArgument(int i) { none() }
|
||||
|
||||
override Type getATypeArgument() { result = this.getTypeArgument(_) }
|
||||
/** Gets a type argument. */
|
||||
Type getATypeArgument() { result = this.getTypeArgument(_) }
|
||||
|
||||
/** Gets the annotated type of type argument `i`. */
|
||||
final AnnotatedType getAnnotatedTypeArgument(int i) { result.appliesToTypeArgument(this, i) }
|
||||
|
||||
/** Gets the total number of type arguments. */
|
||||
final int getNumberOfTypeArguments() { result = count(int i | exists(this.getTypeArgument(i))) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*
|
||||
* Constructs the label suffix for a generic method or type.
|
||||
*/
|
||||
deprecated string getGenericsLabel(Generic g) {
|
||||
result = "`" + g.(UnboundGeneric).getNumberOfTypeParameters()
|
||||
or
|
||||
result = "<" + typeArgs(g) + ">"
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
deprecated private string getTypeArgumentLabel(ConstructedGeneric generic, int p) {
|
||||
result = generic.getTypeArgument(p).getLabel()
|
||||
}
|
||||
|
||||
language[monotonicAggregates]
|
||||
pragma[nomagic]
|
||||
deprecated private string typeArgs(ConstructedGeneric generic) {
|
||||
result =
|
||||
concat(int p |
|
||||
p in [0 .. generic.getNumberOfTypeArguments() - 1]
|
||||
|
|
||||
getTypeArgumentLabel(generic, p), ","
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets the type arguments as a comma-separated string. */
|
||||
@@ -160,7 +202,10 @@ class UnboundGenericType extends ValueOrRefType, UnboundGeneric {
|
||||
/**
|
||||
* A type parameter, for example `T` in `List<T>`.
|
||||
*/
|
||||
class TypeParameter extends DotNet::TypeParameter, Type, @type_parameter {
|
||||
class TypeParameter extends Type, @type_parameter {
|
||||
/** Gets the generic type or method declaring this type parameter. */
|
||||
UnboundGeneric getDeclaringGeneric() { this = result.getATypeParameter() }
|
||||
|
||||
/** Gets the constraints on this type parameter, if any. */
|
||||
TypeParameterConstraints getConstraints() { result.getTypeParameter() = this }
|
||||
|
||||
@@ -216,8 +261,13 @@ class TypeParameter extends DotNet::TypeParameter, Type, @type_parameter {
|
||||
result = this.getASuppliedType().(TypeParameter).getAnUltimatelySuppliedType()
|
||||
}
|
||||
|
||||
/** Gets the index of this type parameter. For example the index of `U` in `Func<T,U>` is 1. */
|
||||
override int getIndex() { type_parameters(this, result, _, _) }
|
||||
|
||||
deprecated final override string getLabel() { result = "!" + this.getIndex() }
|
||||
|
||||
override string getUndecoratedName() { result = "!" + this.getIndex() }
|
||||
|
||||
/** Gets the generic that defines this type parameter. */
|
||||
UnboundGeneric getGeneric() { type_parameters(this, _, result, _) }
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import Callable
|
||||
import Element
|
||||
import Modifier
|
||||
import Variable
|
||||
private import dotnet
|
||||
private import Implements
|
||||
private import TypeRef
|
||||
private import commons.QualifiedName
|
||||
@@ -26,8 +25,46 @@ private module FullyQualifiedNameInput implements QualifiedNameInputSig {
|
||||
*
|
||||
* Either a modifiable (`Modifiable`) or an assignable (`Assignable`).
|
||||
*/
|
||||
class Declaration extends DotNet::Declaration, Element, @declaration {
|
||||
override ValueOrRefType getDeclaringType() { none() }
|
||||
class Declaration extends NamedElement, @declaration {
|
||||
/** Gets the name of this declaration, without additional decoration such as `<...>`. */
|
||||
string getUndecoratedName() { none() }
|
||||
|
||||
/** Holds if this element has undecorated name 'name'. */
|
||||
final predicate hasUndecoratedName(string name) { name = this.getUndecoratedName() }
|
||||
|
||||
/**
|
||||
* Gets the unbound version of this declaration, that is, the declaration where
|
||||
* all type arguments have been removed. For example, in
|
||||
*
|
||||
* ```csharp
|
||||
* class C<T>
|
||||
* {
|
||||
* class Nested
|
||||
* {
|
||||
* }
|
||||
*
|
||||
* void Method<S>() { }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* we have the following
|
||||
*
|
||||
* | Declaration | Unbound declaration |
|
||||
* |-------------------------|---------------------|
|
||||
* | `C<int>` | ``C`1`` |
|
||||
* | ``C`1.Nested`` | ``C`1.Nested`` |
|
||||
* | `C<int>.Nested` | ``C`1.Nested`` |
|
||||
* | ``C`1.Method`1`` | ``C`1.Method`1`` |
|
||||
* | ``C<int>.Method`1`` | ``C`1.Method`1`` |
|
||||
* | `C<int>.Method<string>` | ``C`1.Method`1`` |
|
||||
*/
|
||||
Declaration getUnboundDeclaration() { result = this }
|
||||
|
||||
/** Holds if this declaration is unbound. */
|
||||
final predicate isUnboundDeclaration() { this.getUnboundDeclaration() = this }
|
||||
|
||||
/** Gets the type containing this declaration, if any. */
|
||||
ValueOrRefType getDeclaringType() { none() }
|
||||
|
||||
/** Holds if this declaration is unconstructed and in source code. */
|
||||
final predicate isSourceDeclaration() { this.fromSource() and this.isUnboundDeclaration() }
|
||||
@@ -222,33 +259,27 @@ class Modifiable extends Declaration, @modifiable {
|
||||
}
|
||||
|
||||
/** A declaration that is a member of a type. */
|
||||
class Member extends DotNet::Member, Modifiable, @member {
|
||||
class Member extends Modifiable, @member {
|
||||
/** Gets an access to this member. */
|
||||
MemberAccess getAnAccess() { result.getTarget() = this }
|
||||
|
||||
override predicate isPublic() { Modifiable.super.isPublic() }
|
||||
|
||||
override predicate isProtected() { Modifiable.super.isProtected() }
|
||||
|
||||
override predicate isPrivate() { Modifiable.super.isPrivate() }
|
||||
|
||||
override predicate isInternal() { Modifiable.super.isInternal() }
|
||||
|
||||
override predicate isSealed() { Modifiable.super.isSealed() }
|
||||
|
||||
override predicate isAbstract() { Modifiable.super.isAbstract() }
|
||||
|
||||
override predicate isStatic() { Modifiable.super.isStatic() }
|
||||
|
||||
override predicate isRequired() { Modifiable.super.isRequired() }
|
||||
|
||||
override predicate isFile() { Modifiable.super.isFile() }
|
||||
|
||||
deprecated final override predicate hasQualifiedName(string namespace, string type, string name) {
|
||||
/**
|
||||
* DEPRECATED: Use `hasFullyQualifiedName` instead.
|
||||
*
|
||||
* Holds if this member has name `name` and is defined in type `type`
|
||||
* with namespace `namespace`.
|
||||
*/
|
||||
cached
|
||||
deprecated final predicate hasQualifiedName(string namespace, string type, string name) {
|
||||
QualifiedName<QualifiedNameInput>::hasQualifiedName(this, namespace, type, name)
|
||||
}
|
||||
|
||||
final override predicate hasFullyQualifiedName(string namespace, string type, string name) {
|
||||
/**
|
||||
* Holds if this member has name `name` and is defined in type `type`
|
||||
* with namespace `namespace`.
|
||||
*/
|
||||
cached
|
||||
final predicate hasFullyQualifiedName(string namespace, string type, string name) {
|
||||
QualifiedName<FullyQualifiedNameInput>::hasQualifiedName(this, namespace, type, name)
|
||||
}
|
||||
}
|
||||
@@ -477,10 +508,24 @@ class Virtualizable extends Overridable, Member, @virtualizable {
|
||||
* A parameterizable declaration. Either a callable (`Callable`), a delegate
|
||||
* type (`DelegateType`), or an indexer (`Indexer`).
|
||||
*/
|
||||
class Parameterizable extends DotNet::Parameterizable, Declaration, @parameterizable {
|
||||
override Parameter getRawParameter(int i) { params(result, _, _, i, _, this, _) }
|
||||
class Parameterizable extends Declaration, @parameterizable {
|
||||
/** Gets raw parameter `i`, including the `this` parameter at index 0. */
|
||||
Parameter getRawParameter(int i) { params(result, _, _, i, _, this, _) }
|
||||
|
||||
override Parameter getParameter(int i) { params(result, _, _, i, _, this, _) }
|
||||
/** Gets the `i`th parameter, excluding the `this` parameter. */
|
||||
Parameter getParameter(int i) { params(result, _, _, i, _, this, _) }
|
||||
|
||||
/** Gets the number of parameters of this callable. */
|
||||
int getNumberOfParameters() { result = count(this.getAParameter()) }
|
||||
|
||||
/** Holds if this declaration has no parameters. */
|
||||
predicate hasNoParameters() { not exists(this.getAParameter()) }
|
||||
|
||||
/** Gets a parameter, if any. */
|
||||
Parameter getAParameter() { result = this.getParameter(_) }
|
||||
|
||||
/** Gets a raw parameter (including the qualifier), if any. */
|
||||
final Parameter getARawParameter() { result = this.getRawParameter(_) }
|
||||
|
||||
/**
|
||||
* Gets the type of the parameter, possibly prefixed
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/** Provides classes for namespaces. */
|
||||
|
||||
private import semmle.code.csharp.commons.QualifiedName
|
||||
import Element
|
||||
import Type
|
||||
private import dotnet
|
||||
|
||||
/**
|
||||
* A type container. Either a namespace (`Namespace`) or a type (`Type`).
|
||||
@@ -18,24 +18,44 @@ class TypeContainer extends Declaration, @type_container { }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Namespace extends DotNet::Namespace, TypeContainer, Declaration, @namespace {
|
||||
class Namespace extends TypeContainer, Declaration, @namespace {
|
||||
override Namespace getParent() { result = this.getParentNamespace() }
|
||||
|
||||
override Namespace getParentNamespace() { parent_namespace(this, result) }
|
||||
/**
|
||||
* Gets the parent namespace, if any. For example the parent namespace of `System.IO`
|
||||
* is `System`. The parent namespace of `System` is the global namespace.
|
||||
*/
|
||||
Namespace getParentNamespace() { parent_namespace(this, result) }
|
||||
|
||||
override Namespace getAChildNamespace() { parent_namespace(result, this) }
|
||||
/**
|
||||
* Gets a child namespace, if any. For example `System.IO` is a child in
|
||||
* the namespace `System`.
|
||||
*/
|
||||
Namespace getAChildNamespace() { parent_namespace(result, this) }
|
||||
|
||||
override TypeContainer getChild(int i) {
|
||||
i = 0 and
|
||||
parent_namespace(result, this)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this namespace has the qualified name `qualifier`.`name`.
|
||||
*
|
||||
* For example if the qualified name is `System.Collections.Generic`, then
|
||||
* `qualifier`=`System.Collections` and `name`=`Generic`.
|
||||
*/
|
||||
deprecated override predicate hasQualifiedName(string qualifier, string name) {
|
||||
DotNet::Namespace.super.hasQualifiedName(qualifier, name)
|
||||
namespaceHasQualifiedName(this, qualifier, name)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this namespace has the qualified name `qualifier`.`name`.
|
||||
*
|
||||
* For example if the qualified name is `System.Collections.Generic`, then
|
||||
* `qualifier`=`System.Collections` and `name`=`Generic`.
|
||||
*/
|
||||
override predicate hasFullyQualifiedName(string qualifier, string name) {
|
||||
DotNet::Namespace.super.hasFullyQualifiedName(qualifier, name)
|
||||
namespaceHasQualifiedName(this, qualifier, name)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +143,28 @@ class Namespace extends DotNet::Namespace, TypeContainer, Declaration, @namespac
|
||||
|
||||
override Location getALocation() { result = this.getADeclaration().getALocation() }
|
||||
|
||||
override string toString() { result = DotNet::Namespace.super.toString() }
|
||||
/** Gets a textual representation of this namespace. */
|
||||
override string toString() { result = this.getFullName() }
|
||||
|
||||
/** Holds if this is the global namespace. */
|
||||
final predicate isGlobalNamespace() { this.getName() = "" }
|
||||
|
||||
/** Gets the simple name of this namespace, for example `IO` in `System.IO`. */
|
||||
final override string getName() { namespaces(this, result) }
|
||||
|
||||
final override string getUndecoratedName() { namespaces(this, result) }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Namespace" }
|
||||
|
||||
/**
|
||||
* Get the fully qualified name of this namespace.
|
||||
*/
|
||||
string getFullName() {
|
||||
exists(string namespace, string name |
|
||||
namespaceHasQualifiedName(this, namespace, name) and
|
||||
result = getQualifiedName(namespace, name)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
import Member
|
||||
import Stmt
|
||||
import Type
|
||||
private import cil
|
||||
private import dotnet
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import TypeRef
|
||||
|
||||
@@ -113,7 +111,7 @@ class DeclarationWithGetSetAccessors extends DeclarationWithAccessors, TopLevelE
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Property extends DotNet::Property, DeclarationWithGetSetAccessors, @property {
|
||||
class Property extends DeclarationWithGetSetAccessors, @property {
|
||||
override string getName() { properties(this, result, _, _, _) }
|
||||
|
||||
override string getUndecoratedName() { properties(this, result, _, _, _) }
|
||||
@@ -558,8 +556,6 @@ class TrivialProperty extends Property {
|
||||
this.isAutoImplemented()
|
||||
or
|
||||
this.getGetter().trivialGetterField() = this.getSetter().trivialSetterField()
|
||||
or
|
||||
exists(CIL::TrivialProperty prop | this.matchesHandle(prop))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import Location
|
||||
import Namespace
|
||||
import Property
|
||||
private import Conversion
|
||||
private import dotnet
|
||||
private import semmle.code.csharp.metrics.Coupling
|
||||
private import TypeRef
|
||||
private import semmle.code.csharp.frameworks.System
|
||||
@@ -20,7 +19,10 @@ private import semmle.code.csharp.frameworks.system.runtime.CompilerServices
|
||||
* a pointer type (`PointerType`), the arglist type (`ArglistType`), an unknown
|
||||
* type (`UnknownType`), or a type parameter (`TypeParameter`).
|
||||
*/
|
||||
class Type extends DotNet::Type, Member, TypeContainer, @type {
|
||||
class Type extends Member, TypeContainer, @type {
|
||||
/** Gets the name of this type without additional syntax such as `[]` or `*`. */
|
||||
override string getUndecoratedName() { none() }
|
||||
|
||||
override string getName() { types(this, _, result) }
|
||||
|
||||
override Type getUnboundDeclaration() { result = this }
|
||||
@@ -56,7 +58,7 @@ private predicate isObjectClass(Class c) { c instanceof ObjectType }
|
||||
*
|
||||
* Either a value type (`ValueType`) or a reference type (`RefType`).
|
||||
*/
|
||||
class ValueOrRefType extends DotNet::ValueOrRefType, Type, Attributable, @value_or_ref_type {
|
||||
class ValueOrRefType extends Type, Attributable, @value_or_ref_type {
|
||||
/** Gets the namespace containing this type. */
|
||||
Namespace getNamespace() {
|
||||
if exists(this.getDeclaringType())
|
||||
@@ -64,7 +66,8 @@ class ValueOrRefType extends DotNet::ValueOrRefType, Type, Attributable, @value_
|
||||
else result.getATypeDeclaration() = this
|
||||
}
|
||||
|
||||
override Namespace getDeclaringNamespace() { this = result.getATypeDeclaration() }
|
||||
/** Gets the namespace declaring this type, if any. */
|
||||
Namespace getDeclaringNamespace() { this = result.getATypeDeclaration() }
|
||||
|
||||
override ValueOrRefType getDeclaringType() { none() }
|
||||
|
||||
@@ -73,6 +76,30 @@ class ValueOrRefType extends DotNet::ValueOrRefType, Type, Attributable, @value_
|
||||
/** Gets a nested child type, if any. */
|
||||
NestedType getAChildType() { nested_types(result, this, _) }
|
||||
|
||||
deprecated private string getPrefixWithTypes() {
|
||||
result = this.getDeclaringType().getLabel() + "."
|
||||
or
|
||||
if this.getDeclaringNamespace().isGlobalNamespace()
|
||||
then result = ""
|
||||
else result = this.getDeclaringNamespace().getFullName() + "."
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
deprecated private string getLabelNonGeneric() {
|
||||
not this instanceof Generic and
|
||||
result = this.getPrefixWithTypes() + this.getUndecoratedName()
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
deprecated private string getLabelGeneric() {
|
||||
result = this.getPrefixWithTypes() + this.getUndecoratedName() + getGenericsLabel(this)
|
||||
}
|
||||
|
||||
deprecated override string getLabel() {
|
||||
result = this.getLabelNonGeneric() or
|
||||
result = this.getLabelGeneric()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source namespace declaration in which this type is declared, if any.
|
||||
* This only holds for non-nested types.
|
||||
@@ -120,7 +147,7 @@ class ValueOrRefType extends DotNet::ValueOrRefType, Type, Attributable, @value_
|
||||
}
|
||||
|
||||
/** Gets an immediate base type of this type, if any. */
|
||||
override ValueOrRefType getABaseType() {
|
||||
ValueOrRefType getABaseType() {
|
||||
result = this.getBaseClass() or
|
||||
result = this.getABaseInterface()
|
||||
}
|
||||
@@ -360,7 +387,8 @@ class ValueOrRefType extends DotNet::ValueOrRefType, Type, Attributable, @value_
|
||||
nested_types(this, _, result)
|
||||
}
|
||||
|
||||
override predicate isRecord() { this.hasModifier("record") }
|
||||
/** Holds if this type is a `record`. */
|
||||
predicate isRecord() { this.hasModifier("record") }
|
||||
|
||||
override string toString() { result = Type.super.toString() }
|
||||
}
|
||||
@@ -969,7 +997,7 @@ class FunctionPointerType extends Type, Parameterizable, @function_pointer_type
|
||||
|
||||
override string getAPrimaryQlClass() { result = "FunctionPointerType" }
|
||||
|
||||
override string getLabel() { result = this.getName() }
|
||||
deprecated override string getLabel() { result = this.getName() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1064,7 +1092,7 @@ class InlineArrayType extends ValueType, @inline_array_type {
|
||||
/**
|
||||
* An array type, for example `int[]`.
|
||||
*/
|
||||
class ArrayType extends DotNet::ArrayType, RefType, @array_type {
|
||||
class ArrayType extends RefType, @array_type {
|
||||
/**
|
||||
* Gets the dimension of this array type. For example `int[][]` is of
|
||||
* dimension 2, while `int[]` is of dimension 1.
|
||||
@@ -1081,13 +1109,15 @@ class ArrayType extends DotNet::ArrayType, RefType, @array_type {
|
||||
predicate isMultiDimensional() { this.getRank() > 1 }
|
||||
|
||||
/** Gets the element type of this array, for example `int` in `int[]`. */
|
||||
override Type getElementType() {
|
||||
Type getElementType() {
|
||||
array_element_type(this, _, _, result)
|
||||
or
|
||||
not array_element_type(this, _, _, any(Type t)) and
|
||||
array_element_type(this, _, _, getTypeRef(result))
|
||||
}
|
||||
|
||||
deprecated final override string getLabel() { result = this.getElementType().getLabel() + "[]" }
|
||||
|
||||
/** Holds if this array type has the same shape (dimension and rank) as `that` array type. */
|
||||
predicate hasSameShapeAs(ArrayType that) {
|
||||
this.getDimension() = that.getDimension() and
|
||||
@@ -1128,33 +1158,36 @@ class ArrayType extends DotNet::ArrayType, RefType, @array_type {
|
||||
not type_location(this, _) and
|
||||
result = this.getElementType().getALocation()
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ArrayType" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A pointer type, for example `char*`.
|
||||
*/
|
||||
class PointerType extends DotNet::PointerType, Type, @pointer_type {
|
||||
override Type getReferentType() {
|
||||
class PointerType extends Type, @pointer_type {
|
||||
/** Gets the type referred by this pointer type, for example `char` in `char*`. */
|
||||
Type getReferentType() {
|
||||
pointer_referent_type(this, result)
|
||||
or
|
||||
not pointer_referent_type(this, any(Type t)) and
|
||||
pointer_referent_type(this, getTypeRef(result))
|
||||
}
|
||||
|
||||
override string toStringWithTypes() { result = DotNet::PointerType.super.toStringWithTypes() }
|
||||
override string toStringWithTypes() { result = this.getReferentType().toStringWithTypes() + "*" }
|
||||
|
||||
override Type getChild(int n) { result = this.getReferentType() and n = 0 }
|
||||
|
||||
final override string getName() { types(this, _, result) }
|
||||
|
||||
deprecated final override string getLabel() { result = this.getReferentType().getLabel() + "*" }
|
||||
|
||||
final override string getUndecoratedName() {
|
||||
result = this.getReferentType().getUndecoratedName()
|
||||
}
|
||||
|
||||
override Location getALocation() { result = this.getReferentType().getALocation() }
|
||||
|
||||
override string toString() { result = DotNet::PointerType.super.toString() }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "PointerType" }
|
||||
}
|
||||
|
||||
@@ -1238,7 +1271,7 @@ class TupleType extends ValueType, @tuple_type {
|
||||
")"
|
||||
}
|
||||
|
||||
override string getLabel() { result = this.getUnderlyingType().getLabel() }
|
||||
deprecated override string getLabel() { result = this.getUnderlyingType().getLabel() }
|
||||
|
||||
override Type getChild(int i) { result = this.getUnderlyingType().getChild(i) }
|
||||
|
||||
|
||||
@@ -7,18 +7,18 @@ import Assignable
|
||||
import Callable
|
||||
import Element
|
||||
import Type
|
||||
private import dotnet
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import TypeRef
|
||||
|
||||
/**
|
||||
* A variable. Either a variable with local scope (`LocalScopeVariable`) or a field (`Field`).
|
||||
*/
|
||||
class Variable extends Assignable, DotNet::Variable, @variable {
|
||||
class Variable extends Assignable, @variable {
|
||||
override Variable getUnboundDeclaration() { result = this }
|
||||
|
||||
override VariableAccess getAnAccess() { result.getTarget() = this }
|
||||
|
||||
/** Gets the type of this variable. */
|
||||
override Type getType() { none() }
|
||||
|
||||
/** Gets the expression used to initialise this variable, if any. */
|
||||
@@ -87,9 +87,10 @@ class LocalScopeVariable extends Variable, @local_scope_variable {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Parameter extends DotNet::Parameter, LocalScopeVariable, Attributable, TopLevelExprParent,
|
||||
@parameter
|
||||
{
|
||||
class Parameter extends LocalScopeVariable, Attributable, TopLevelExprParent, @parameter {
|
||||
/** Gets the raw position of this parameter, including the `this` parameter at index 0. */
|
||||
final int getRawPosition() { this = this.getDeclaringElement().getRawParameter(result) }
|
||||
|
||||
/**
|
||||
* Gets the position of this parameter. For example, the position of `x` is
|
||||
* 0 and the position of `y` is 1 in
|
||||
@@ -100,7 +101,7 @@ class Parameter extends DotNet::Parameter, LocalScopeVariable, Attributable, Top
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
override int getPosition() { params(this, _, _, result, _, _, _) }
|
||||
int getPosition() { params(this, _, _, result, _, _, _) }
|
||||
|
||||
override int getIndex() { result = this.getPosition() }
|
||||
|
||||
@@ -138,7 +139,7 @@ class Parameter extends DotNet::Parameter, LocalScopeVariable, Attributable, Top
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
override predicate isOut() { params(this, _, _, _, 2, _, _) }
|
||||
predicate isOut() { params(this, _, _, _, 2, _, _) }
|
||||
|
||||
/**
|
||||
* Holds if this parameter is a value type that is passed in by reference.
|
||||
@@ -193,7 +194,7 @@ class Parameter extends DotNet::Parameter, LocalScopeVariable, Attributable, Top
|
||||
predicate hasExtensionMethodModifier() { params(this, _, _, _, 4, _, _) }
|
||||
|
||||
/** Gets the declaring element of this parameter. */
|
||||
override Parameterizable getDeclaringElement() { params(this, _, _, _, _, result, _) }
|
||||
Parameterizable getDeclaringElement() { params(this, _, _, _, _, result, _) }
|
||||
|
||||
override Parameter getUnboundDeclaration() { params(this, _, _, _, _, _, result) }
|
||||
|
||||
@@ -396,9 +397,7 @@ class LocalConstant extends LocalVariable, @local_constant {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Field extends Variable, AssignableMember, Attributable, TopLevelExprParent, DotNet::Field,
|
||||
@field
|
||||
{
|
||||
class Field extends Variable, AssignableMember, Attributable, TopLevelExprParent, @field {
|
||||
/**
|
||||
* Gets the initial value of this field, if any. For example, the initial
|
||||
* value of `F` on line 2 is `20` in
|
||||
|
||||
@@ -3,56 +3,13 @@
|
||||
*/
|
||||
|
||||
import csharp
|
||||
private import cil
|
||||
private import dotnet
|
||||
|
||||
private predicate isDisposeMethod(DotNet::Callable method) {
|
||||
private predicate isDisposeMethod(Callable method) {
|
||||
method.getName() = "Dispose" and
|
||||
method.getNumberOfParameters() = 0
|
||||
}
|
||||
|
||||
private predicate cilVariableReadFlowsToNode(CIL::Variable variable, DataFlow::Node n) {
|
||||
n.asExpr() = variable.getARead()
|
||||
or
|
||||
exists(DataFlow::Node mid |
|
||||
cilVariableReadFlowsToNode(variable, mid) and
|
||||
DataFlow::localFlowStep(mid, n)
|
||||
)
|
||||
}
|
||||
|
||||
private predicate cilVariableReadFlowsTo(CIL::Variable variable, CIL::DataFlowNode n) {
|
||||
cilVariableReadFlowsToNode(variable, DataFlow::exprNode(n))
|
||||
}
|
||||
|
||||
private predicate disposedCilVariable(CIL::Variable variable) {
|
||||
// `variable` is the `this` parameter on a dispose method.
|
||||
isDisposeMethod(variable.(CIL::ThisParameter).getMethod())
|
||||
or
|
||||
// `variable` is passed to a method that disposes it.
|
||||
exists(CIL::Call call, CIL::Parameter param |
|
||||
cilVariableReadFlowsTo(variable, call.getArgumentForParameter(param)) and
|
||||
disposedCilVariable(param)
|
||||
)
|
||||
or
|
||||
// A parameter is disposed if its source declaration is disposed
|
||||
disposedCilVariable(variable.(CIL::Parameter).getUnboundDeclaration())
|
||||
or
|
||||
// A variable is disposed if it's assigned to another variable
|
||||
// that may be disposed.
|
||||
exists(CIL::WriteAccess write |
|
||||
cilVariableReadFlowsTo(variable, write.getExpr()) and
|
||||
disposedCilVariable(write.getTarget())
|
||||
)
|
||||
}
|
||||
|
||||
private predicate disposedCSharpVariable(Variable variable) {
|
||||
// A C# parameter is disposed if its corresponding CIL parameter is disposed
|
||||
exists(CIL::Method m, CIL::Parameter p, int i |
|
||||
disposedCilVariable(p) and p = m.getRawParameter(i)
|
||||
|
|
||||
variable = any(Callable c2 | c2.matchesHandle(m)).getRawParameter(i)
|
||||
)
|
||||
or
|
||||
// Call to a method that disposes it
|
||||
exists(Call call, int arg, VariableRead read |
|
||||
read.getTarget() = variable and
|
||||
@@ -83,7 +40,4 @@ private predicate disposedCSharpVariable(Variable variable) {
|
||||
* Hold if `variable` might be disposed.
|
||||
* This is a conservative overestimate.
|
||||
*/
|
||||
predicate mayBeDisposed(DotNet::Variable variable) {
|
||||
disposedCSharpVariable(variable) or
|
||||
disposedCilVariable(variable)
|
||||
}
|
||||
predicate mayBeDisposed(Variable variable) { disposedCSharpVariable(variable) }
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** Provides predicates for working with fully qualified names. */
|
||||
|
||||
private import csharp
|
||||
private import dotnet
|
||||
|
||||
/**
|
||||
* Holds if namespace `n` has the qualified name `qualifier`.`name`.
|
||||
@@ -9,8 +8,8 @@ private import dotnet
|
||||
* For example if the qualified name is `System.Collections.Generic`, then
|
||||
* `qualifier`=`System.Collections` and `name`=`Generic`.
|
||||
*/
|
||||
predicate namespaceHasQualifiedName(DotNet::Namespace n, string qualifier, string name) {
|
||||
if n instanceof DotNet::GlobalNamespace
|
||||
predicate namespaceHasQualifiedName(Namespace n, string qualifier, string name) {
|
||||
if n instanceof GlobalNamespace
|
||||
then qualifier = "" and name = ""
|
||||
else (
|
||||
exists(string pqualifier, string pname |
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
*/
|
||||
|
||||
import csharp
|
||||
private import cil
|
||||
private import dotnet
|
||||
private import ControlFlow::SuccessorTypes
|
||||
private import semmle.code.csharp.commons.Assertions
|
||||
private import semmle.code.csharp.commons.ComparisonTest
|
||||
@@ -844,8 +842,6 @@ class NullGuardedDataFlowNode extends GuardedDataFlowNode {
|
||||
|
||||
/** INTERNAL: Do not use. */
|
||||
module Internal {
|
||||
private import semmle.code.cil.CallableReturns
|
||||
|
||||
newtype TAbstractValue =
|
||||
TBooleanValue(boolean b) { b = true or b = false } or
|
||||
TIntegerValue(int i) { i = any(Expr e).getValue().toInt() } or
|
||||
@@ -856,20 +852,11 @@ module Internal {
|
||||
} or
|
||||
TEmptyCollectionValue(boolean b) { b = true or b = false }
|
||||
|
||||
/** A callable that always returns a `null` value. */
|
||||
private class NullCallable extends Callable {
|
||||
NullCallable() {
|
||||
exists(CIL::Method m | m.matchesHandle(this) | alwaysNullMethod(m) and not m.isVirtual())
|
||||
}
|
||||
}
|
||||
|
||||
/** Holds if expression `e` is a `null` value. */
|
||||
predicate nullValue(Expr e) {
|
||||
e instanceof NullLiteral
|
||||
or
|
||||
e instanceof DefaultValueExpr and e.getType().isRefType()
|
||||
or
|
||||
e.(Call).getTarget().getUnboundDeclaration() instanceof NullCallable
|
||||
}
|
||||
|
||||
/** Holds if expression `e2` is a `null` value whenever `e1` is. */
|
||||
@@ -890,11 +877,7 @@ module Internal {
|
||||
|
||||
/** A callable that always returns a non-`null` value. */
|
||||
private class NonNullCallable extends Callable {
|
||||
NonNullCallable() {
|
||||
exists(CIL::Method m | m.matchesHandle(this) | alwaysNotNullMethod(m) and not m.isVirtual())
|
||||
or
|
||||
this = any(SystemObjectClass c).getGetTypeMethod()
|
||||
}
|
||||
NonNullCallable() { this = any(SystemObjectClass c).getGetTypeMethod() }
|
||||
}
|
||||
|
||||
/** Holds if expression `e` is a non-`null` value. */
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
*/
|
||||
|
||||
import csharp
|
||||
private import cil
|
||||
private import semmle.code.cil.CallableReturns
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import semmle.code.csharp.commons.Assertions
|
||||
private import semmle.code.csharp.frameworks.System
|
||||
@@ -39,15 +37,6 @@ private class ThrowingCall extends NonReturningCall {
|
||||
or
|
||||
this.(FailingAssertion).getAssertionFailure().isException(c.getExceptionClass())
|
||||
or
|
||||
exists(Callable target, CIL::Method m, CIL::Type ex |
|
||||
target = this.getTarget() and
|
||||
not target.hasBody() and
|
||||
target.matchesHandle(m) and
|
||||
alwaysThrowsException(m, ex) and
|
||||
c.getExceptionClass().matchesHandle(ex) and
|
||||
not m.isVirtual()
|
||||
)
|
||||
or
|
||||
this =
|
||||
any(MethodCall mc |
|
||||
mc.getTarget()
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
*/
|
||||
|
||||
import csharp
|
||||
private import cil
|
||||
private import semmle.code.csharp.dataflow.Nullness
|
||||
private import semmle.code.cil.CallableReturns as CR
|
||||
|
||||
private predicate finalCallable(Callable c) {
|
||||
not c.(Virtualizable).isVirtual() and
|
||||
@@ -15,19 +13,11 @@ private predicate finalCallable(Callable c) {
|
||||
/** Holds if callable `c` always returns null. */
|
||||
predicate alwaysNullCallable(Callable c) {
|
||||
finalCallable(c) and
|
||||
(
|
||||
exists(CIL::Method m | m.matchesHandle(c) | CR::alwaysNullMethod(m))
|
||||
or
|
||||
forex(Expr e | c.canReturn(e) | e instanceof AlwaysNullExpr)
|
||||
)
|
||||
forex(Expr e | c.canReturn(e) | e instanceof AlwaysNullExpr)
|
||||
}
|
||||
|
||||
/** Holds if callable `c` always returns a non-null value. */
|
||||
predicate alwaysNotNullCallable(Callable c) {
|
||||
finalCallable(c) and
|
||||
(
|
||||
exists(CIL::Method m | m.matchesHandle(c) | CR::alwaysNotNullMethod(m))
|
||||
or
|
||||
forex(Expr e | c.canReturn(e) | e instanceof NonNullExpr)
|
||||
)
|
||||
forex(Expr e | c.canReturn(e) | e instanceof NonNullExpr)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
private import csharp
|
||||
private import cil
|
||||
private import dotnet
|
||||
private import DataFlowImplCommon as DataFlowImplCommon
|
||||
private import DataFlowPublic
|
||||
private import DataFlowPrivate
|
||||
@@ -14,30 +12,11 @@ private import semmle.code.csharp.frameworks.system.collections.Generic
|
||||
/**
|
||||
* Gets a source declaration of callable `c` that has a body or has
|
||||
* a flow summary.
|
||||
*
|
||||
* If the callable has both CIL and source code, return only the source
|
||||
* code version.
|
||||
*/
|
||||
DotNet::Callable getCallableForDataFlow(DotNet::Callable c) {
|
||||
exists(DotNet::Callable unboundDecl | unboundDecl = c.getUnboundDeclaration() |
|
||||
result.hasBody() and
|
||||
if unboundDecl.getFile().fromSource()
|
||||
then
|
||||
// C# callable with C# implementation in the database
|
||||
result = unboundDecl
|
||||
else
|
||||
if unboundDecl instanceof CIL::Callable
|
||||
then
|
||||
// CIL callable with C# implementation in the database
|
||||
unboundDecl.matchesHandle(result.(Callable))
|
||||
or
|
||||
// CIL callable without C# implementation in the database
|
||||
not unboundDecl.matchesHandle(any(Callable k | k.hasBody())) and
|
||||
result = unboundDecl
|
||||
else
|
||||
// C# callable without C# implementation in the database
|
||||
unboundDecl.matchesHandle(result.(CIL::Callable))
|
||||
)
|
||||
Callable getCallableForDataFlow(Callable c) {
|
||||
result = c.getUnboundDeclaration() and
|
||||
result.hasBody() and
|
||||
result.getFile().fromSource()
|
||||
}
|
||||
|
||||
newtype TReturnKind =
|
||||
@@ -67,7 +46,7 @@ private module Cached {
|
||||
*/
|
||||
cached
|
||||
newtype TDataFlowCallable =
|
||||
TDotNetCallable(DotNet::Callable c) { c.isUnboundDeclaration() } or
|
||||
TCallable(Callable c) { c.isUnboundDeclaration() } or
|
||||
TSummarizedCallable(DataFlowSummarizedCallable sc) or
|
||||
TFieldOrPropertyCallable(FieldOrProperty f) or
|
||||
TCapturedVariableCallable(LocalScopeVariable v) { v.isCaptured() }
|
||||
@@ -81,10 +60,6 @@ private module Cached {
|
||||
TExplicitDelegateLikeCall(ControlFlow::Nodes::ElementNode cfn, DelegateLikeCall dc) {
|
||||
cfn.getAstNode() = dc
|
||||
} or
|
||||
TCilCall(CIL::Call call) {
|
||||
// No need to include calls that are compiled from source
|
||||
not call.getImplementation().getMethod().compiledFromSource()
|
||||
} or
|
||||
TSummaryCall(FlowSummary::SummarizedCallable c, FlowSummaryImpl::Private::SummaryNode receiver) {
|
||||
FlowSummaryImpl::Private::summaryCallbackRange(c, receiver)
|
||||
}
|
||||
@@ -197,7 +172,7 @@ class RefReturnKind extends OutRefReturnKind, TRefReturnKind {
|
||||
/** A callable used for data flow. */
|
||||
class DataFlowCallable extends TDataFlowCallable {
|
||||
/** Gets the underlying source code callable, if any. */
|
||||
DotNet::Callable asCallable() { this = TDotNetCallable(result) }
|
||||
Callable asCallable() { this = TCallable(result) }
|
||||
|
||||
/** Gets the underlying summarized callable, if any. */
|
||||
FlowSummary::SummarizedCallable asSummarizedCallable() { this = TSummarizedCallable(result) }
|
||||
@@ -208,7 +183,7 @@ class DataFlowCallable extends TDataFlowCallable {
|
||||
LocalScopeVariable asCapturedVariable() { this = TCapturedVariableCallable(result) }
|
||||
|
||||
/** Gets the underlying callable. */
|
||||
DotNet::Callable getUnderlyingCallable() {
|
||||
Callable getUnderlyingCallable() {
|
||||
result = this.asCallable() or result = this.asSummarizedCallable()
|
||||
}
|
||||
|
||||
@@ -235,8 +210,7 @@ class DataFlowCallable extends TDataFlowCallable {
|
||||
abstract class DataFlowCall extends TDataFlowCall {
|
||||
/**
|
||||
* Gets a run-time target of this call. A target is always a source
|
||||
* declaration, and if the callable has both CIL and source code, only
|
||||
* the source code version is returned.
|
||||
* declaration.
|
||||
*/
|
||||
abstract DataFlowCallable getARuntimeTarget();
|
||||
|
||||
@@ -250,7 +224,7 @@ abstract class DataFlowCall extends TDataFlowCall {
|
||||
abstract DataFlowCallable getEnclosingCallable();
|
||||
|
||||
/** Gets the underlying expression, if any. */
|
||||
final DotNet::Expr getExpr() { result = this.getNode().asExpr() }
|
||||
final Expr getExpr() { result = this.getNode().asExpr() }
|
||||
|
||||
/** Gets the argument at position `pos` of this call. */
|
||||
final ArgumentNode getArgument(ArgumentPosition pos) { result.argumentOf(this, pos) }
|
||||
@@ -348,33 +322,6 @@ class ExplicitDelegateLikeDataFlowCall extends DelegateDataFlowCall, TExplicitDe
|
||||
override Location getLocation() { result = cfn.getLocation() }
|
||||
}
|
||||
|
||||
/** A CIL call relevant for data flow. */
|
||||
class CilDataFlowCall extends DataFlowCall, TCilCall {
|
||||
private CIL::Call call;
|
||||
|
||||
CilDataFlowCall() { this = TCilCall(call) }
|
||||
|
||||
/** Gets the underlying CIL call. */
|
||||
CIL::Call getCilCall() { result = call }
|
||||
|
||||
override DataFlowCallable getARuntimeTarget() {
|
||||
// There is no dispatch library for CIL, so do not consider overrides for now
|
||||
result.getUnderlyingCallable() = getCallableForDataFlow(call.getTarget())
|
||||
}
|
||||
|
||||
override ControlFlow::Nodes::ElementNode getControlFlowNode() { none() }
|
||||
|
||||
override DataFlow::ExprNode getNode() { result.getExpr() = call }
|
||||
|
||||
override DataFlowCallable getEnclosingCallable() {
|
||||
result.asCallable() = call.getEnclosingCallable()
|
||||
}
|
||||
|
||||
override string toString() { result = call.toString() }
|
||||
|
||||
override Location getLocation() { result = call.getLocation() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A synthesized call inside a callable with a flow summary.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
private import csharp
|
||||
private import cil
|
||||
private import dotnet
|
||||
private import DataFlowPublic
|
||||
private import DataFlowDispatch
|
||||
private import DataFlowImplCommon
|
||||
@@ -18,8 +16,6 @@ private import semmle.code.csharp.frameworks.NHibernate
|
||||
private import semmle.code.csharp.frameworks.Razor
|
||||
private import semmle.code.csharp.frameworks.system.Collections
|
||||
private import semmle.code.csharp.frameworks.system.threading.Tasks
|
||||
private import semmle.code.cil.Ssa::Ssa as CilSsa
|
||||
private import semmle.code.cil.internal.SsaImpl as CilSsaImpl
|
||||
private import codeql.util.Unit
|
||||
private import codeql.util.Boolean
|
||||
|
||||
@@ -57,15 +53,15 @@ abstract class NodeImpl extends Node {
|
||||
|
||||
/** Do not call: use `getType()` instead. */
|
||||
cached
|
||||
abstract DotNet::Type getTypeImpl();
|
||||
abstract Type getTypeImpl();
|
||||
|
||||
/** Gets the type of this node used for type pruning. */
|
||||
DataFlowType getDataFlowType() {
|
||||
forceCachingInSameStage() and
|
||||
exists(Type t0 | result.asGvnType() = Gvn::getGlobalValueNumber(t0) |
|
||||
t0 = getCSharpType(this.getType())
|
||||
t0 = this.getType()
|
||||
or
|
||||
not exists(getCSharpType(this.getType())) and
|
||||
not exists(this.getType()) and
|
||||
t0 instanceof ObjectType
|
||||
)
|
||||
}
|
||||
@@ -96,16 +92,12 @@ private DataFlowCallable getEnclosingStaticFieldOrProperty(Expr e) {
|
||||
|
||||
private class ExprNodeImpl extends ExprNode, NodeImpl {
|
||||
override DataFlowCallable getEnclosingCallableImpl() {
|
||||
result.asCallable() =
|
||||
[
|
||||
this.getExpr().(CIL::Expr).getEnclosingCallable().(DotNet::Callable),
|
||||
this.getControlFlowNodeImpl().getEnclosingCallable()
|
||||
]
|
||||
result.asCallable() = this.getControlFlowNodeImpl().getEnclosingCallable()
|
||||
or
|
||||
result = getEnclosingStaticFieldOrProperty(this.asExpr())
|
||||
}
|
||||
|
||||
override DotNet::Type getTypeImpl() {
|
||||
override Type getTypeImpl() {
|
||||
forceCachingInSameStage() and
|
||||
result = this.getExpr().getType()
|
||||
}
|
||||
@@ -121,11 +113,6 @@ private class ExprNodeImpl extends ExprNode, NodeImpl {
|
||||
override string toStringImpl() {
|
||||
forceCachingInSameStage() and
|
||||
result = this.getControlFlowNodeImpl().toString()
|
||||
or
|
||||
exists(CIL::Expr e |
|
||||
this = TCilExprNode(e) and
|
||||
result = e.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,12 +247,6 @@ predicate hasNodePath(ControlFlowReachabilityConfiguration conf, ExprNode n1, No
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets the CIL data-flow node for `node`, if any. */
|
||||
CIL::DataFlowNode asCilDataFlowNode(Node node) {
|
||||
result = node.asParameter() or
|
||||
result = node.asExpr()
|
||||
}
|
||||
|
||||
/** Provides logic related to captured variables. */
|
||||
module VariableCapture {
|
||||
private import codeql.dataflow.VariableCapture as Shared
|
||||
@@ -731,79 +712,6 @@ module LocalFlow {
|
||||
)
|
||||
}
|
||||
|
||||
private module CilFlow {
|
||||
/**
|
||||
* Holds if `nodeFrom` is a last node referencing SSA definition `def`, which
|
||||
* can reach `next`.
|
||||
*/
|
||||
private predicate localFlowCilSsaInput(
|
||||
Node nodeFrom, CilSsaImpl::DefinitionExt def, CilSsaImpl::DefinitionExt next
|
||||
) {
|
||||
exists(CIL::BasicBlock bb, int i | CilSsaImpl::lastRefBeforeRedefExt(def, bb, i, next) |
|
||||
def.definesAt(_, bb, i, _) and
|
||||
def = nodeFrom.(CilSsaDefinitionExtNode).getDefinition() and
|
||||
def != next
|
||||
or
|
||||
nodeFrom = TCilExprNode(bb.getNode(i).(CIL::ReadAccess))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if there is a local flow step from `nodeFrom` to `nodeTo` involving
|
||||
* CIL SSA definition `def`.
|
||||
*/
|
||||
private predicate localCilSsaFlowStep(CilSsaImpl::DefinitionExt def, Node nodeFrom, Node nodeTo) {
|
||||
// Flow into SSA definition
|
||||
exists(CIL::VariableUpdate vu |
|
||||
vu = def.(CilSsa::Definition).getVariableUpdate() and
|
||||
vu.getSource() = asCilDataFlowNode(nodeFrom) and
|
||||
def = nodeTo.(CilSsaDefinitionExtNode).getDefinition()
|
||||
)
|
||||
or
|
||||
// Flow from SSA definition to first read
|
||||
def = nodeFrom.(CilSsaDefinitionExtNode).getDefinition() and
|
||||
nodeTo = TCilExprNode(CilSsaImpl::getAFirstReadExt(def))
|
||||
or
|
||||
// Flow from read to next read
|
||||
exists(CIL::ReadAccess readFrom, CIL::ReadAccess readTo |
|
||||
CilSsaImpl::hasAdjacentReadsExt(def, readFrom, readTo) and
|
||||
nodeTo = TCilExprNode(readTo) and
|
||||
nodeFrom = TCilExprNode(readFrom) and
|
||||
nodeFrom != nodeTo
|
||||
)
|
||||
or
|
||||
// Flow into phi (read) node
|
||||
exists(CilSsaImpl::DefinitionExt phi |
|
||||
localFlowCilSsaInput(nodeFrom, def, phi) and
|
||||
phi = nodeTo.(CilSsaDefinitionExtNode).getDefinition()
|
||||
|
|
||||
phi instanceof CilSsa::PhiNode
|
||||
or
|
||||
phi instanceof CilSsaImpl::PhiReadNode
|
||||
)
|
||||
}
|
||||
|
||||
private predicate localExactStep(CIL::DataFlowNode src, CIL::DataFlowNode sink) {
|
||||
src = sink.(CIL::Opcodes::Dup).getAnOperand()
|
||||
or
|
||||
src = sink.(CIL::Conversion).getExpr()
|
||||
or
|
||||
src = sink.(CIL::WriteAccess).getExpr()
|
||||
or
|
||||
src = sink.(CIL::Method).getAnImplementation().getAnInstruction().(CIL::Return)
|
||||
or
|
||||
src = sink.(CIL::Return).getExpr()
|
||||
or
|
||||
src = sink.(CIL::ConditionalBranch).getAnOperand()
|
||||
}
|
||||
|
||||
predicate localFlowStepCil(Node nodeFrom, Node nodeTo) {
|
||||
localExactStep(asCilDataFlowNode(nodeFrom), asCilDataFlowNode(nodeTo))
|
||||
or
|
||||
localCilSsaFlowStep(_, nodeFrom, nodeTo)
|
||||
}
|
||||
}
|
||||
|
||||
predicate localFlowStepCommon(Node nodeFrom, Node nodeTo) {
|
||||
hasNodePath(any(LocalExprStepConfiguration x), nodeFrom, nodeTo)
|
||||
or
|
||||
@@ -812,8 +720,6 @@ module LocalFlow {
|
||||
or
|
||||
ThisFlow::adjacentThisRefs(nodeFrom.(PostUpdateNode).getPreUpdateNode(), nodeTo)
|
||||
or
|
||||
CilFlow::localFlowStepCil(nodeFrom, nodeTo)
|
||||
or
|
||||
exists(AssignableDefinition def, ControlFlow::Node cfn, Ssa::ExplicitDefinition ssaDef |
|
||||
ssaDef.getADefinition() = def and
|
||||
ssaDef.getControlFlowNode() = cfn and
|
||||
@@ -1115,13 +1021,6 @@ private predicate arrayStore(Expr e, Expr src, Expr a, boolean postUpdate) {
|
||||
*/
|
||||
private predicate arrayRead(Expr e1, ArrayRead e2) { e1 = e2.getQualifier() }
|
||||
|
||||
private Type getCSharpType(DotNet::Type t) {
|
||||
result = t
|
||||
or
|
||||
not t instanceof Type and
|
||||
result.matchesHandle(t)
|
||||
}
|
||||
|
||||
private class RelevantGvnType extends Gvn::GvnType {
|
||||
RelevantGvnType() { this = any(NodeImpl n).getDataFlowType().asGvnType() }
|
||||
}
|
||||
@@ -1193,8 +1092,6 @@ private module Cached {
|
||||
cached
|
||||
newtype TNode =
|
||||
TExprNode(ControlFlow::Nodes::ElementNode cfn) { cfn.getAstNode() instanceof Expr } or
|
||||
TCilExprNode(CIL::Expr e) { e.getImplementation() instanceof CIL::BestImplementation } or
|
||||
TCilSsaDefinitionExtNode(CilSsaImpl::DefinitionExt def) or
|
||||
TSsaDefinitionExtNode(SsaImpl::DefinitionExt def) {
|
||||
// Handled by `TExplicitParameterNode` below
|
||||
not def.(Ssa::ExplicitDefinition).getADefinition() instanceof
|
||||
@@ -1205,7 +1102,7 @@ private module Cached {
|
||||
// Handled by `TExplicitParameterNode` below
|
||||
not def instanceof AssignableDefinitions::ImplicitParameterDefinition
|
||||
} or
|
||||
TExplicitParameterNode(DotNet::Parameter p) {
|
||||
TExplicitParameterNode(Parameter p) {
|
||||
p = any(DataFlowCallable dfc).asCallable().getAParameter()
|
||||
} or
|
||||
TInstanceParameterNode(InstanceCallable c) or
|
||||
@@ -1375,28 +1272,6 @@ predicate nodeIsHidden(Node n) {
|
||||
n instanceof CaptureNode
|
||||
}
|
||||
|
||||
/** A CIL SSA definition, viewed as a node in a data flow graph. */
|
||||
class CilSsaDefinitionExtNode extends NodeImpl, TCilSsaDefinitionExtNode {
|
||||
CilSsaImpl::DefinitionExt def;
|
||||
|
||||
CilSsaDefinitionExtNode() { this = TCilSsaDefinitionExtNode(def) }
|
||||
|
||||
/** Gets the underlying SSA definition. */
|
||||
CilSsaImpl::DefinitionExt getDefinition() { result = def }
|
||||
|
||||
override DataFlowCallable getEnclosingCallableImpl() {
|
||||
result.asCallable() = def.getBasicBlock().getFirstNode().getImplementation().getMethod()
|
||||
}
|
||||
|
||||
override CIL::Type getTypeImpl() { result = def.getSourceVariable().getType() }
|
||||
|
||||
override ControlFlow::Node getControlFlowNodeImpl() { none() }
|
||||
|
||||
override Location getLocationImpl() { result = def.getBasicBlock().getLocation() }
|
||||
|
||||
override string toStringImpl() { result = def.toString() }
|
||||
}
|
||||
|
||||
/** An SSA definition, viewed as a node in a data flow graph. */
|
||||
class SsaDefinitionExtNode extends NodeImpl, TSsaDefinitionExtNode {
|
||||
SsaImpl::DefinitionExt def;
|
||||
@@ -1468,7 +1343,7 @@ private module ParameterNodes {
|
||||
* flow graph.
|
||||
*/
|
||||
class ExplicitParameterNode extends ParameterNodeImpl, TExplicitParameterNode {
|
||||
private DotNet::Parameter parameter;
|
||||
private Parameter parameter;
|
||||
|
||||
ExplicitParameterNode() { this = TExplicitParameterNode(parameter) }
|
||||
|
||||
@@ -1486,7 +1361,7 @@ private module ParameterNodes {
|
||||
result.asCallable() = parameter.getCallable()
|
||||
}
|
||||
|
||||
override DotNet::Type getTypeImpl() { result = parameter.getType() }
|
||||
override Type getTypeImpl() { result = parameter.getType() }
|
||||
|
||||
override ControlFlow::Node getControlFlowNodeImpl() { none() }
|
||||
|
||||
@@ -1543,7 +1418,7 @@ private module ParameterNodes {
|
||||
|
||||
override Location getLocationImpl() { result = callable.getLocation() }
|
||||
|
||||
override DotNet::Type getTypeImpl() { none() }
|
||||
override Type getTypeImpl() { none() }
|
||||
|
||||
override DataFlowType getDataFlowType() { callable = result.asDelegate() }
|
||||
|
||||
@@ -1612,11 +1487,7 @@ private module ArgumentNodes {
|
||||
|
||||
/** A data-flow node that represents an explicit call argument. */
|
||||
class ExplicitArgumentNode extends ArgumentNodeImpl {
|
||||
ExplicitArgumentNode() {
|
||||
this.asExpr() instanceof Argument
|
||||
or
|
||||
this.asExpr() = any(CilDataFlowCall cc).getCilCall().getAnArgument()
|
||||
}
|
||||
ExplicitArgumentNode() { this.asExpr() instanceof Argument }
|
||||
|
||||
override predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
|
||||
exists(ArgumentConfiguration x, Expr c, Argument arg |
|
||||
@@ -1625,12 +1496,6 @@ private module ArgumentNodes {
|
||||
arg.isArgumentOf(c, pos) and
|
||||
x.hasExprPath(_, this.getControlFlowNode(), _, call.getControlFlowNode())
|
||||
)
|
||||
or
|
||||
exists(CIL::Call c, CIL::Expr arg |
|
||||
arg = this.asExpr() and
|
||||
c = call.getExpr() and
|
||||
arg = c.getArgument(pos.getPosition())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1747,7 +1612,7 @@ private module ReturnNodes {
|
||||
*/
|
||||
class ExprReturnNode extends ReturnNode, ExprNode {
|
||||
ExprReturnNode() {
|
||||
exists(DotNet::Callable c, DotNet::Expr e | e = this.getExpr() |
|
||||
exists(Callable c, Expr e | e = this.getExpr() |
|
||||
c.canReturn(e) and not c.(Modifiable).isAsync()
|
||||
)
|
||||
}
|
||||
@@ -1881,17 +1746,13 @@ private module OutNodes {
|
||||
}
|
||||
|
||||
/**
|
||||
* A data-flow node that reads a value returned directly by a callable,
|
||||
* either via a C# call or a CIL call.
|
||||
* A data-flow node that reads a value returned directly by a callable.
|
||||
*/
|
||||
class ExprOutNode extends OutNode, ExprNode {
|
||||
private DataFlowCall call;
|
||||
|
||||
ExprOutNode() {
|
||||
exists(DotNet::Expr e | e = this.getExpr() |
|
||||
call = csharpCall(e, this.getControlFlowNode()) or
|
||||
call = TCilCall(e)
|
||||
)
|
||||
exists(Expr e | e = this.getExpr() | call = csharpCall(e, this.getControlFlowNode()))
|
||||
}
|
||||
|
||||
override DataFlowCall getCall(ReturnKind kind) {
|
||||
@@ -1973,7 +1834,7 @@ class FlowSummaryNode extends NodeImpl, TFlowSummaryNode {
|
||||
result = FlowSummaryImpl::Private::summaryNodeType(this.getSummaryNode())
|
||||
}
|
||||
|
||||
override DotNet::Type getTypeImpl() { none() }
|
||||
override Type getTypeImpl() { none() }
|
||||
|
||||
override ControlFlow::Node getControlFlowNodeImpl() { none() }
|
||||
|
||||
@@ -2134,8 +1995,6 @@ class FieldOrProperty extends Assignable, Modifiable {
|
||||
or
|
||||
p.isAutoImplementedReadOnly()
|
||||
or
|
||||
p.matchesHandle(any(CIL::TrivialProperty tp))
|
||||
or
|
||||
p.getDeclaringType() instanceof AnonymousClass
|
||||
)
|
||||
)
|
||||
@@ -2740,7 +2599,7 @@ module PostUpdateNodes {
|
||||
result = getEnclosingStaticFieldOrProperty(oc)
|
||||
}
|
||||
|
||||
override DotNet::Type getTypeImpl() { result = oc.getType() }
|
||||
override Type getTypeImpl() { result = oc.getType() }
|
||||
|
||||
override ControlFlow::Nodes::ElementNode getControlFlowNodeImpl() { result = cfn }
|
||||
|
||||
@@ -2853,7 +2712,7 @@ class CastNode extends Node {
|
||||
}
|
||||
}
|
||||
|
||||
class DataFlowExpr = DotNet::Expr;
|
||||
class DataFlowExpr = Expr;
|
||||
|
||||
/** Holds if `e` is an expression that always has the same Boolean value `val`. */
|
||||
private predicate constantBooleanExpr(Expr e, boolean val) {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
private import csharp
|
||||
private import cil
|
||||
private import dotnet
|
||||
private import DataFlowDispatch
|
||||
private import DataFlowPrivate
|
||||
private import semmle.code.csharp.controlflow.Guards
|
||||
@@ -12,7 +10,7 @@ private import semmle.code.csharp.Unification
|
||||
*/
|
||||
class Node extends TNode {
|
||||
/** Gets the expression corresponding to this node, if any. */
|
||||
DotNet::Expr asExpr() { result = this.(ExprNode).getExpr() }
|
||||
Expr asExpr() { result = this.(ExprNode).getExpr() }
|
||||
|
||||
/**
|
||||
* Gets the expression corresponding to this node, at control flow node `cfn`,
|
||||
@@ -23,7 +21,7 @@ class Node extends TNode {
|
||||
}
|
||||
|
||||
/** Gets the parameter corresponding to this node, if any. */
|
||||
DotNet::Parameter asParameter() { result = this.(ParameterNode).getParameter() }
|
||||
Parameter asParameter() { result = this.(ParameterNode).getParameter() }
|
||||
|
||||
/** Gets the definition corresponding to this node, if any. */
|
||||
AssignableDefinition asDefinition() { result = this.asDefinitionAtNode(_) }
|
||||
@@ -37,7 +35,7 @@ class Node extends TNode {
|
||||
}
|
||||
|
||||
/** Gets the type of this node. */
|
||||
final DotNet::Type getType() { result = this.(NodeImpl).getTypeImpl() }
|
||||
final Type getType() { result = this.(NodeImpl).getTypeImpl() }
|
||||
|
||||
/** Gets the enclosing callable of this node. */
|
||||
final Callable getEnclosingCallable() {
|
||||
@@ -67,8 +65,6 @@ class Node extends TNode {
|
||||
}
|
||||
}
|
||||
|
||||
private class TExprNode_ = TExprNode or TCilExprNode;
|
||||
|
||||
/**
|
||||
* An expression, viewed as a node in a data flow graph.
|
||||
*
|
||||
@@ -76,13 +72,9 @@ private class TExprNode_ = TExprNode or TCilExprNode;
|
||||
* to multiple `ExprNode`s, just like it may correspond to multiple
|
||||
* `ControlFlow::Node`s.
|
||||
*/
|
||||
class ExprNode extends Node, TExprNode_ {
|
||||
class ExprNode extends Node, TExprNode {
|
||||
/** Gets the expression corresponding to this node. */
|
||||
DotNet::Expr getExpr() {
|
||||
result = this.getExprAtNode(_)
|
||||
or
|
||||
this = TCilExprNode(result)
|
||||
}
|
||||
Expr getExpr() { result = this.getExprAtNode(_) }
|
||||
|
||||
/**
|
||||
* Gets the expression corresponding to this node, at control flow node `cfn`,
|
||||
@@ -94,16 +86,22 @@ class ExprNode extends Node, TExprNode_ {
|
||||
}
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private predicate isParameterOf0(DataFlowCallable c, ParameterPosition ppos, Parameter p) {
|
||||
p.getCallable() = c.asCallable() and
|
||||
p.getPosition() = ppos.getPosition()
|
||||
}
|
||||
|
||||
/**
|
||||
* The value of a parameter at function entry, viewed as a node in a data
|
||||
* flow graph.
|
||||
*/
|
||||
class ParameterNode extends Node instanceof ParameterNodeImpl {
|
||||
/** Gets the parameter corresponding to this node, if any. */
|
||||
DotNet::Parameter getParameter() {
|
||||
Parameter getParameter() {
|
||||
exists(DataFlowCallable c, ParameterPosition ppos |
|
||||
super.isParameterOf(c, ppos) and
|
||||
result = c.asCallable().getParameter(ppos.getPosition())
|
||||
isParameterOf0(c, ppos, result)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -120,12 +118,12 @@ class AssignableDefinitionNode extends Node instanceof AssignableDefinitionNodeI
|
||||
}
|
||||
|
||||
/** Gets a node corresponding to expression `e`. */
|
||||
ExprNode exprNode(DotNet::Expr e) { result.getExpr() = e }
|
||||
ExprNode exprNode(Expr e) { result.getExpr() = e }
|
||||
|
||||
/**
|
||||
* Gets the node corresponding to the value of parameter `p` at function entry.
|
||||
*/
|
||||
ParameterNode parameterNode(DotNet::Parameter p) { result.getParameter() = p }
|
||||
ParameterNode parameterNode(Parameter p) { result.getParameter() = p }
|
||||
|
||||
/** Gets a node corresponding to the definition `def`. */
|
||||
AssignableDefinitionNode assignableDefinitionNode(AssignableDefinition def) {
|
||||
@@ -146,7 +144,7 @@ predicate localFlow(Node source, Node sink) { localFlowStep*(source, sink) }
|
||||
* local (intra-procedural) steps.
|
||||
*/
|
||||
pragma[inline]
|
||||
predicate localExprFlow(DotNet::Expr e1, DotNet::Expr e2) { localFlow(exprNode(e1), exprNode(e2)) }
|
||||
predicate localExprFlow(Expr e1, Expr e2) { localFlow(exprNode(e1), exprNode(e2)) }
|
||||
|
||||
/**
|
||||
* A data flow node that jumps between callables. This can be extended in
|
||||
|
||||
@@ -7,8 +7,6 @@ private import semmle.code.csharp.dataflow.internal.DataFlowPrivate
|
||||
private import semmle.code.csharp.dataflow.internal.ControlFlowReachability
|
||||
private import semmle.code.csharp.dispatch.Dispatch
|
||||
private import semmle.code.csharp.commons.ComparisonTest
|
||||
private import cil
|
||||
private import dotnet
|
||||
// import `TaintedMember` definitions from other files to avoid potential reevaluation
|
||||
private import semmle.code.csharp.frameworks.JsonNET
|
||||
private import semmle.code.csharp.frameworks.WCF
|
||||
@@ -33,16 +31,6 @@ predicate defaultTaintSanitizer(DataFlow::Node node) {
|
||||
bindingset[node]
|
||||
predicate defaultImplicitTaintRead(DataFlow::Node node, DataFlow::ContentSet c) { none() }
|
||||
|
||||
private predicate localCilTaintStep(CIL::DataFlowNode src, CIL::DataFlowNode sink) {
|
||||
src = sink.(CIL::BinaryArithmeticExpr).getAnOperand() or
|
||||
src = sink.(CIL::Opcodes::Neg).getOperand() or
|
||||
src = sink.(CIL::UnaryBitwiseOperation).getOperand()
|
||||
}
|
||||
|
||||
private predicate localTaintStepCil(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
|
||||
localCilTaintStep(asCilDataFlowNode(nodeFrom), asCilDataFlowNode(nodeTo))
|
||||
}
|
||||
|
||||
private class LocalTaintExprStepConfiguration extends ControlFlowReachabilityConfiguration {
|
||||
LocalTaintExprStepConfiguration() { this = "LocalTaintExprStepConfiguration" }
|
||||
|
||||
@@ -106,8 +94,6 @@ private class LocalTaintExprStepConfiguration extends ControlFlowReachabilityCon
|
||||
|
||||
private predicate localTaintStepCommon(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
|
||||
hasNodePath(any(LocalTaintExprStepConfiguration x), nodeFrom, nodeTo)
|
||||
or
|
||||
localTaintStepCil(nodeFrom, nodeTo)
|
||||
}
|
||||
|
||||
cached
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
*/
|
||||
|
||||
import csharp
|
||||
private import cil
|
||||
private import dotnet
|
||||
|
||||
/**
|
||||
* A run-time callable. That is, a callable that is neither abstract
|
||||
* nor defined in an interface.
|
||||
*/
|
||||
class RuntimeCallable extends DotNet::Callable {
|
||||
class RuntimeCallable extends Callable {
|
||||
RuntimeCallable() {
|
||||
not this.(Modifiable).isAbstract() and
|
||||
(
|
||||
@@ -23,15 +21,7 @@ class RuntimeCallable extends DotNet::Callable {
|
||||
}
|
||||
|
||||
/** A run-time method. */
|
||||
class RuntimeMethod extends RuntimeCallable {
|
||||
RuntimeMethod() {
|
||||
this instanceof Method or
|
||||
this instanceof CIL::Method
|
||||
}
|
||||
|
||||
/** Holds if the method is `static`. */
|
||||
predicate isStatic() { this.(Method).isStatic() or this.(CIL::Method).isStatic() }
|
||||
}
|
||||
class RuntimeMethod extends RuntimeCallable, Method { }
|
||||
|
||||
/** A run-time instance method. */
|
||||
class RuntimeInstanceMethod extends RuntimeMethod {
|
||||
|
||||
@@ -8,7 +8,6 @@ import Expr
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowDispatch
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowImplCommon
|
||||
private import semmle.code.csharp.dispatch.Dispatch
|
||||
private import dotnet
|
||||
|
||||
/**
|
||||
* A call. Either a method call (`MethodCall`), a constructor initializer call
|
||||
@@ -16,7 +15,7 @@ private import dotnet
|
||||
* a delegate call (`DelegateCall`), an accessor call (`AccessorCall`), a
|
||||
* constructor call (`ObjectCreation`), or a local function call (`LocalFunctionCall`).
|
||||
*/
|
||||
class Call extends DotNet::Call, Expr, @call {
|
||||
class Call extends Expr, @call {
|
||||
/**
|
||||
* Gets the static (compile-time) target of this call. For example, the
|
||||
* static target of `x.M()` on line 9 is `A.M` in
|
||||
@@ -38,13 +37,19 @@ class Call extends DotNet::Call, Expr, @call {
|
||||
* Use `getARuntimeTarget()` instead to get a potential run-time target (will
|
||||
* include `B.M` in the example above).
|
||||
*/
|
||||
override Callable getTarget() { none() }
|
||||
Callable getTarget() { none() }
|
||||
|
||||
override Expr getArgument(int i) { result = this.getChild(i) and i >= 0 }
|
||||
/** Gets the `i`th argument to this call, if any. */
|
||||
Expr getArgument(int i) { result = this.getChild(i) and i >= 0 }
|
||||
|
||||
override Expr getRawArgument(int i) { result = this.getArgument(i) }
|
||||
/**
|
||||
* Gets the `i`th "raw" argument to this call, if any.
|
||||
* For instance methods, argument 0 is the qualifier.
|
||||
*/
|
||||
Expr getRawArgument(int i) { result = this.getArgument(i) }
|
||||
|
||||
override Expr getAnArgument() { result = this.getArgument(_) }
|
||||
/** Gets an argument to this call. */
|
||||
Expr getAnArgument() { result = this.getArgument(_) }
|
||||
|
||||
/** Gets the number of arguments of this call. */
|
||||
int getNumberOfArguments() { result = count(this.getAnArgument()) }
|
||||
@@ -59,7 +64,7 @@ class Call extends DotNet::Call, Expr, @call {
|
||||
* consider default arguments.
|
||||
*/
|
||||
cached
|
||||
override Expr getArgumentForParameter(DotNet::Parameter p) {
|
||||
Expr getArgumentForParameter(Parameter p) {
|
||||
// Appears in the positional part of the call
|
||||
result = this.getImplicitArgument(p)
|
||||
or
|
||||
@@ -69,7 +74,7 @@ class Call extends DotNet::Call, Expr, @call {
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
private Expr getImplicitArgument(DotNet::Parameter p) {
|
||||
private Expr getImplicitArgument(Parameter p) {
|
||||
this.getTarget().getAParameter() = p and
|
||||
not exists(result.getExplicitArgumentName()) and
|
||||
(
|
||||
@@ -144,7 +149,7 @@ class Call extends DotNet::Call, Expr, @call {
|
||||
* - Line 16: There is no static target (delegate call) but the delegate `i => { }`
|
||||
* (line 20) is a run-time target.
|
||||
*/
|
||||
override Callable getARuntimeTarget() {
|
||||
Callable getARuntimeTarget() {
|
||||
exists(DispatchCall dc | dc.getCall() = this | result = dc.getADynamicTarget())
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import semmle.code.csharp.controlflow.ControlFlowElement
|
||||
import semmle.code.csharp.Location
|
||||
import semmle.code.csharp.Stmt
|
||||
import semmle.code.csharp.Type
|
||||
private import dotnet
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import semmle.code.csharp.frameworks.System
|
||||
private import semmle.code.csharp.TypeRef
|
||||
@@ -38,11 +37,11 @@ private import semmle.code.csharp.TypeRef
|
||||
* interpolated string (`InterpolatedStringExpr`), a qualifiable expression
|
||||
* (`QualifiableExpr`), or a literal (`Literal`).
|
||||
*/
|
||||
class Expr extends DotNet::Expr, ControlFlowElement, @expr {
|
||||
class Expr extends ControlFlowElement, @expr {
|
||||
override Location getALocation() { expr_location(this, result) }
|
||||
|
||||
/** Gets the type of this expression. */
|
||||
override Type getType() {
|
||||
Type getType() {
|
||||
expressions(this, _, result)
|
||||
or
|
||||
not expressions(this, _, any(Type t)) and
|
||||
@@ -53,7 +52,10 @@ class Expr extends DotNet::Expr, ControlFlowElement, @expr {
|
||||
final AnnotatedType getAnnotatedType() { result.appliesTo(this) }
|
||||
|
||||
/** Gets the value of this expression, if any */
|
||||
override string getValue() { expr_value(this, result) }
|
||||
string getValue() { expr_value(this, result) }
|
||||
|
||||
/** Holds if this expression has a value. */
|
||||
final predicate hasValue() { exists(this.getValue()) }
|
||||
|
||||
/** Gets the enclosing statement of this expression, if any. */
|
||||
final Stmt getEnclosingStmt() { enclosingStmt(this, result) }
|
||||
@@ -88,6 +90,10 @@ class Expr extends DotNet::Expr, ControlFlowElement, @expr {
|
||||
*/
|
||||
string getExplicitArgumentName() { expr_argument_name(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the parent of this expression. This is for example the element
|
||||
* that uses the result of this expression.
|
||||
*/
|
||||
override Element getParent() { result = ControlFlowElement.super.getParent() }
|
||||
|
||||
/** Holds if the nullable flow state of this expression is not null. */
|
||||
@@ -943,13 +949,13 @@ class InterpolatedStringExpr extends Expr, @interpolated_string_expr {
|
||||
* A `throw` element. Either a `throw` expression (`ThrowExpr`)
|
||||
* or a `throw` statement (`ThrowStmt`).
|
||||
*/
|
||||
class ThrowElement extends ControlFlowElement, DotNet::Throw, @throw_element {
|
||||
class ThrowElement extends ControlFlowElement, @throw_element {
|
||||
/**
|
||||
* Gets the expression of the exception being thrown, if any.
|
||||
*
|
||||
* For example, `new Exception("Syntax error")` in `throw new Exception("Syntax error");`.
|
||||
*/
|
||||
override Expr getExpr() { result = this.getChild(0) }
|
||||
Expr getExpr() { result = this.getChild(0) }
|
||||
|
||||
/** Gets the type of exception being thrown. */
|
||||
Class getThrownExceptionType() {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import Expr
|
||||
private import dotnet
|
||||
|
||||
/**
|
||||
* A literal. Either a Boolean literal (`BoolLiteral`), a Unicode character
|
||||
@@ -13,7 +12,7 @@ private import dotnet
|
||||
* point literal (`RealLiteral`), a `string` literal (`StringLiteral`), or a
|
||||
* `null` literal (`NullLiteral`).
|
||||
*/
|
||||
class Literal extends DotNet::Literal, Expr, @literal_expr {
|
||||
class Literal extends Expr, @literal_expr {
|
||||
override string toString() { result = this.getValue() }
|
||||
}
|
||||
|
||||
@@ -43,7 +42,7 @@ class CharLiteral extends Literal, @char_literal_expr {
|
||||
* literal (`LongLiteral`), a `uint` literal (`UIntLiteral`), or a `ulong`
|
||||
* literal (`ULongLiteral`).
|
||||
*/
|
||||
class IntegerLiteral extends DotNet::IntLiteral, Literal, @integer_literal_expr { }
|
||||
class IntegerLiteral extends Literal, @integer_literal_expr { }
|
||||
|
||||
/**
|
||||
* An `int` literal, for example `0`.
|
||||
@@ -105,7 +104,7 @@ class DecimalLiteral extends RealLiteral, @decimal_literal_expr {
|
||||
* A `string` literal. Either a `string` literal (`StringLiteralUtf16`),
|
||||
* or a `u8` literal (`StringLiteralUtf8`).
|
||||
*/
|
||||
class StringLiteral extends DotNet::StringLiteral, Literal, @string_literal_expr {
|
||||
class StringLiteral extends Literal, @string_literal_expr {
|
||||
override string toString() { result = "\"" + this.getValue().replaceAll("\"", "\\\"") + "\"" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "StringLiteral" }
|
||||
@@ -128,6 +127,6 @@ class StringLiteralUtf8 extends StringLiteral, @utf8_string_literal_expr {
|
||||
/**
|
||||
* A `null` literal.
|
||||
*/
|
||||
class NullLiteral extends DotNet::NullLiteral, Literal, @null_literal_expr {
|
||||
class NullLiteral extends Literal, @null_literal_expr {
|
||||
override string getAPrimaryQlClass() { result = "NullLiteral" }
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import Expr
|
||||
import Parameterizable
|
||||
|
||||
/** A .Net callable. */
|
||||
class Callable extends Parameterizable, @dotnet_callable {
|
||||
deprecated class Callable extends Parameterizable, @dotnet_callable {
|
||||
/** Holds if this callable has a body or an implementation. */
|
||||
predicate hasBody() { none() }
|
||||
|
||||
@@ -85,13 +85,13 @@ class Callable extends Parameterizable, @dotnet_callable {
|
||||
}
|
||||
|
||||
/** A constructor. */
|
||||
abstract class Constructor extends Callable { }
|
||||
abstract deprecated class Constructor extends Callable { }
|
||||
|
||||
/** A destructor/finalizer. */
|
||||
abstract class Destructor extends Callable { }
|
||||
abstract deprecated class Destructor extends Callable { }
|
||||
|
||||
pragma[nomagic]
|
||||
private ValueOrRefType getARecordBaseType(ValueOrRefType t) {
|
||||
deprecated private ValueOrRefType getARecordBaseType(ValueOrRefType t) {
|
||||
exists(Callable c |
|
||||
c.hasName("<Clone>$") and
|
||||
c.getNumberOfParameters() = 0 and
|
||||
@@ -103,7 +103,7 @@ private ValueOrRefType getARecordBaseType(ValueOrRefType t) {
|
||||
}
|
||||
|
||||
/** A clone method on a record. */
|
||||
class RecordCloneCallable extends Callable {
|
||||
deprecated class RecordCloneCallable extends Callable {
|
||||
RecordCloneCallable() {
|
||||
this.getDeclaringType() instanceof ValueOrRefType and
|
||||
this.hasName("<Clone>$") and
|
||||
|
||||
@@ -7,7 +7,7 @@ import Type
|
||||
private import semmle.code.csharp.commons.QualifiedName
|
||||
|
||||
/** A declaration. */
|
||||
class Declaration extends NamedElement, @dotnet_declaration {
|
||||
deprecated class Declaration extends NamedElement, @dotnet_declaration {
|
||||
/** Gets the name of this declaration, without additional decoration such as `<...>`. */
|
||||
string getUndecoratedName() { none() }
|
||||
|
||||
@@ -50,7 +50,7 @@ class Declaration extends NamedElement, @dotnet_declaration {
|
||||
}
|
||||
|
||||
/** A member of a type. */
|
||||
class Member extends Declaration, @dotnet_member {
|
||||
deprecated class Member extends Declaration, @dotnet_member {
|
||||
/** Holds if this member is declared `public`. */
|
||||
predicate isPublic() { none() }
|
||||
|
||||
@@ -102,7 +102,7 @@ class Member extends Declaration, @dotnet_member {
|
||||
}
|
||||
|
||||
/** A property. */
|
||||
class Property extends Member, @dotnet_property {
|
||||
deprecated class Property extends Member, @dotnet_property {
|
||||
/** Gets the getter of this property, if any. */
|
||||
Callable getGetter() { none() }
|
||||
|
||||
@@ -114,7 +114,7 @@ class Property extends Member, @dotnet_property {
|
||||
}
|
||||
|
||||
/** An event. */
|
||||
class Event extends Member, @dotnet_event {
|
||||
deprecated class Event extends Member, @dotnet_event {
|
||||
/** Gets the adder of this event, if any. */
|
||||
Callable getAdder() { none() }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import semmle.code.csharp.Location
|
||||
/**
|
||||
* A .Net program element.
|
||||
*/
|
||||
class Element extends @dotnet_element {
|
||||
deprecated class Element extends @dotnet_element {
|
||||
/** Gets a textual representation of this element. */
|
||||
cached
|
||||
string toString() { none() }
|
||||
@@ -69,7 +69,7 @@ class Element extends @dotnet_element {
|
||||
}
|
||||
|
||||
/** An element that has a name. */
|
||||
class NamedElement extends Element, @dotnet_named_element {
|
||||
deprecated class NamedElement extends Element, @dotnet_named_element {
|
||||
/** Gets the name of this element. */
|
||||
cached
|
||||
string getName() { none() }
|
||||
|
||||
@@ -7,7 +7,7 @@ import Type
|
||||
import Callable
|
||||
|
||||
/** An expression. */
|
||||
class Expr extends Element, @dotnet_expr {
|
||||
deprecated class Expr extends Element, @dotnet_expr {
|
||||
/** Gets the callable containing this expression. */
|
||||
Callable getEnclosingCallable() { none() }
|
||||
|
||||
@@ -28,7 +28,7 @@ class Expr extends Element, @dotnet_expr {
|
||||
}
|
||||
|
||||
/** A call. */
|
||||
class Call extends Expr, @dotnet_call {
|
||||
deprecated class Call extends Expr, @dotnet_call {
|
||||
/** Gets the target of this call. */
|
||||
Callable getTarget() { none() }
|
||||
|
||||
@@ -52,13 +52,13 @@ class Call extends Expr, @dotnet_call {
|
||||
}
|
||||
|
||||
/** A literal expression. */
|
||||
class Literal extends Expr, @dotnet_literal { }
|
||||
deprecated class Literal extends Expr, @dotnet_literal { }
|
||||
|
||||
/** A string literal expression. */
|
||||
class StringLiteral extends Literal, @dotnet_string_literal { }
|
||||
deprecated class StringLiteral extends Literal, @dotnet_string_literal { }
|
||||
|
||||
/** An integer literal expression. */
|
||||
class IntLiteral extends Literal, @dotnet_int_literal { }
|
||||
deprecated class IntLiteral extends Literal, @dotnet_int_literal { }
|
||||
|
||||
/** A `null` literal expression. */
|
||||
class NullLiteral extends Literal, @dotnet_null_literal { }
|
||||
deprecated class NullLiteral extends Literal, @dotnet_null_literal { }
|
||||
|
||||
@@ -6,10 +6,10 @@ import Declaration
|
||||
* A generic declaration. Either an unbound generic (`UnboundGeneric`) or a
|
||||
* constructed generic (`ConstructedGeneric`).
|
||||
*/
|
||||
abstract class Generic extends Declaration, @dotnet_generic { }
|
||||
abstract deprecated class Generic extends Declaration, @dotnet_generic { }
|
||||
|
||||
/** An unbound generic. */
|
||||
abstract class UnboundGeneric extends Generic {
|
||||
abstract deprecated class UnboundGeneric extends Generic {
|
||||
/** Gets the `i`th type parameter, if any. */
|
||||
abstract TypeParameter getTypeParameter(int i);
|
||||
|
||||
@@ -27,7 +27,7 @@ abstract class UnboundGeneric extends Generic {
|
||||
}
|
||||
|
||||
/** A constructed generic. */
|
||||
abstract class ConstructedGeneric extends Generic {
|
||||
abstract deprecated class ConstructedGeneric extends Generic {
|
||||
/** Gets the `i`th type argument, if any. */
|
||||
abstract Type getTypeArgument(int i);
|
||||
|
||||
@@ -49,20 +49,20 @@ abstract class ConstructedGeneric extends Generic {
|
||||
*
|
||||
* Constructs the label suffix for a generic method or type.
|
||||
*/
|
||||
string getGenericsLabel(Generic g) {
|
||||
deprecated string getGenericsLabel(Generic g) {
|
||||
result = "`" + g.(UnboundGeneric).getNumberOfTypeParameters()
|
||||
or
|
||||
result = "<" + typeArgs(g) + ">"
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
private string getTypeArgumentLabel(ConstructedGeneric generic, int p) {
|
||||
deprecated private string getTypeArgumentLabel(ConstructedGeneric generic, int p) {
|
||||
result = generic.getTypeArgument(p).getLabel()
|
||||
}
|
||||
|
||||
language[monotonicAggregates]
|
||||
pragma[nomagic]
|
||||
private string typeArgs(ConstructedGeneric generic) {
|
||||
deprecated private string typeArgs(ConstructedGeneric generic) {
|
||||
result =
|
||||
concat(int p |
|
||||
p in [0 .. generic.getNumberOfTypeArguments() - 1]
|
||||
|
||||
@@ -6,7 +6,7 @@ private import Declaration
|
||||
private import semmle.code.csharp.commons.QualifiedName
|
||||
|
||||
/** A namespace. */
|
||||
class Namespace extends Declaration, @namespace {
|
||||
deprecated class Namespace extends Declaration, @namespace {
|
||||
/**
|
||||
* Gets the parent namespace, if any. For example the parent namespace of `System.IO`
|
||||
* is `System`. The parent namespace of `System` is the global namespace.
|
||||
@@ -64,6 +64,6 @@ class Namespace extends Declaration, @namespace {
|
||||
}
|
||||
|
||||
/** The global namespace. */
|
||||
class GlobalNamespace extends Namespace {
|
||||
deprecated class GlobalNamespace extends Namespace {
|
||||
GlobalNamespace() { this.getName() = "" }
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import Declaration
|
||||
* A general parameterizable entity, such as a callable, delegate type, accessor,
|
||||
* indexer, or function pointer type.
|
||||
*/
|
||||
class Parameterizable extends Declaration, @dotnet_parameterizable {
|
||||
deprecated class Parameterizable extends Declaration, @dotnet_parameterizable {
|
||||
/** Gets raw parameter `i`, including the `this` parameter at index 0. */
|
||||
Parameter getRawParameter(int i) { none() }
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import Generics
|
||||
* A type. Either a value or reference type (`ValueOrRefType`), a type parameter (`TypeParameter`),
|
||||
* a pointer type (`PointerType`), or an array type (`ArrayType`).
|
||||
*/
|
||||
class Type extends Declaration, @dotnet_type {
|
||||
deprecated class Type extends Declaration, @dotnet_type {
|
||||
/** Gets the name of this type without additional syntax such as `[]` or `*`. */
|
||||
override string getUndecoratedName() { none() }
|
||||
}
|
||||
@@ -19,7 +19,7 @@ class Type extends Declaration, @dotnet_type {
|
||||
/**
|
||||
* A value or reference type.
|
||||
*/
|
||||
class ValueOrRefType extends Type, @dotnet_valueorreftype {
|
||||
deprecated class ValueOrRefType extends Type, @dotnet_valueorreftype {
|
||||
/** Gets the namespace declaring this type, if any. */
|
||||
Namespace getDeclaringNamespace() { none() }
|
||||
|
||||
@@ -57,7 +57,7 @@ class ValueOrRefType extends Type, @dotnet_valueorreftype {
|
||||
/**
|
||||
* A type parameter, for example `T` in `System.Nullable<T>`.
|
||||
*/
|
||||
class TypeParameter extends Type, @dotnet_type_parameter {
|
||||
deprecated class TypeParameter extends Type, @dotnet_type_parameter {
|
||||
/** Gets the generic type or method declaring this type parameter. */
|
||||
UnboundGeneric getDeclaringGeneric() { this = result.getATypeParameter() }
|
||||
|
||||
@@ -70,7 +70,7 @@ class TypeParameter extends Type, @dotnet_type_parameter {
|
||||
}
|
||||
|
||||
/** A pointer type. */
|
||||
class PointerType extends Type, @dotnet_pointer_type {
|
||||
deprecated class PointerType extends Type, @dotnet_pointer_type {
|
||||
/** Gets the type referred by this pointer type, for example `char` in `char*`. */
|
||||
Type getReferentType() { none() }
|
||||
|
||||
@@ -82,7 +82,7 @@ class PointerType extends Type, @dotnet_pointer_type {
|
||||
}
|
||||
|
||||
/** An array type. */
|
||||
class ArrayType extends ValueOrRefType, @dotnet_array_type {
|
||||
deprecated class ArrayType extends ValueOrRefType, @dotnet_array_type {
|
||||
/** Gets the type of the array element. */
|
||||
Type getElementType() { none() }
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import Element
|
||||
import Expr
|
||||
|
||||
/** A throw element. */
|
||||
class Throw extends Element, @dotnet_throw {
|
||||
deprecated class Throw extends Element, @dotnet_throw {
|
||||
/** Gets the expression being thrown, if any. */
|
||||
Expr getExpr() { none() }
|
||||
}
|
||||
|
||||
@@ -4,16 +4,16 @@ import Declaration
|
||||
import Callable
|
||||
|
||||
/** A .Net variable. */
|
||||
class Variable extends Declaration, @dotnet_variable {
|
||||
deprecated class Variable extends Declaration, @dotnet_variable {
|
||||
/** Gets the type of this variable. */
|
||||
Type getType() { none() }
|
||||
}
|
||||
|
||||
/** A .Net field. */
|
||||
class Field extends Variable, Member, @dotnet_field { }
|
||||
deprecated class Field extends Variable, Member, @dotnet_field { }
|
||||
|
||||
/** A parameter to a .Net callable, property or function pointer type. */
|
||||
class Parameter extends Variable, @dotnet_parameter {
|
||||
deprecated class Parameter extends Variable, @dotnet_parameter {
|
||||
/** Gets the raw position of this parameter, including the `this` parameter at index 0. */
|
||||
final int getRawPosition() { this = this.getDeclaringElement().getRawParameter(result) }
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
private import csharp
|
||||
private import dotnet
|
||||
|
||||
pragma[nomagic]
|
||||
private predicate isTestNamespace(Namespace ns) {
|
||||
|
||||
@@ -2,4 +2,4 @@ private import csharp as CSharp
|
||||
|
||||
class Function = CSharp::Callable;
|
||||
|
||||
string getIdentityString(Function func) { result = func.getLabel() }
|
||||
string getIdentityString(Function func) { result = func.getFullyQualifiedNameWithTypes() }
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
private import csharp as CS
|
||||
private import dotnet
|
||||
private import semmle.code.csharp.commons.Util as Util
|
||||
private import semmle.code.csharp.commons.Collections as Collections
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowDispatch
|
||||
@@ -62,7 +61,7 @@ predicate isRelevantForTypeBasedFlowModels = isRelevantForModels/1;
|
||||
* In the Standard library and 3rd party libraries it the callables that can be called
|
||||
* from outside the library itself.
|
||||
*/
|
||||
class TargetApiSpecific extends DotNet::Callable {
|
||||
class TargetApiSpecific extends CS::Callable {
|
||||
TargetApiSpecific() {
|
||||
this.fromSource() and
|
||||
this.isUnboundDeclaration()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
private import csharp
|
||||
private import dotnet
|
||||
private import semmle.code.csharp.frameworks.system.collections.Generic as GenericCollections
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowPrivate
|
||||
private import semmle.code.csharp.frameworks.system.linq.Expressions
|
||||
@@ -21,14 +20,14 @@ private predicate genericCollectionType(ValueOrRefType t, TypeParameter tp) {
|
||||
/**
|
||||
* Holds if `tp` is a type parameter of the immediate type declaring `callable`.
|
||||
*/
|
||||
private predicate classTypeParameter(DotNet::Callable callable, TypeParameter tp) {
|
||||
private predicate classTypeParameter(Callable callable, TypeParameter tp) {
|
||||
callable.getDeclaringType().(UnboundGeneric).getATypeParameter() = tp
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `tp` is type parameter of `callable` or the type declaring `callable`.
|
||||
*/
|
||||
private predicate localTypeParameter(DotNet::Callable callable, TypeParameter tp) {
|
||||
private predicate localTypeParameter(Callable callable, TypeParameter tp) {
|
||||
classTypeParameter(callable, tp) or
|
||||
callable.(UnboundGeneric).getATypeParameter() = tp
|
||||
}
|
||||
@@ -37,7 +36,7 @@ private predicate localTypeParameter(DotNet::Callable callable, TypeParameter tp
|
||||
* Holds if `callable` has a parameter of type `tp`
|
||||
* or collection parameterized over type `tp`.
|
||||
*/
|
||||
private predicate parameter(DotNet::Callable callable, string input, TypeParameter tp) {
|
||||
private predicate parameter(Callable callable, string input, TypeParameter tp) {
|
||||
exists(Parameter p |
|
||||
input = Specific::parameterAccess(p) and
|
||||
p = callable.getAParameter() and
|
||||
@@ -62,7 +61,7 @@ private string getSyntheticField(TypeParameter tp) {
|
||||
* Gets a models as data string representation of, how a value of type `tp`
|
||||
* can be read or stored implicitly in relation to `callable`.
|
||||
*/
|
||||
private string implicit(DotNet::Callable callable, TypeParameter tp) {
|
||||
private string implicit(Callable callable, TypeParameter tp) {
|
||||
classTypeParameter(callable, tp) and
|
||||
not callable.(Modifiable).isStatic() and
|
||||
exists(string access |
|
||||
@@ -77,7 +76,7 @@ private string implicit(DotNet::Callable callable, TypeParameter tp) {
|
||||
/**
|
||||
* Holds if `callable` has a delegate parameter `dt` at parameter position `position`.
|
||||
*/
|
||||
private predicate delegate(DotNet::Callable callable, DelegateType dt, int position) {
|
||||
private predicate delegate(Callable callable, DelegateType dt, int position) {
|
||||
exists(Parameter p |
|
||||
p = callable.getAParameter() and
|
||||
dt = p.getType().(SystemLinqExpressions::DelegateExtType).getDelegateType() and
|
||||
@@ -93,7 +92,7 @@ private predicate delegate(DotNet::Callable callable, DelegateType dt, int posit
|
||||
* in every disjunction.
|
||||
*/
|
||||
bindingset[callable]
|
||||
private string getAccess(DotNet::Callable callable, Type return, TypeParameter tp) {
|
||||
private string getAccess(Callable callable, Type return, TypeParameter tp) {
|
||||
return = tp and result = ""
|
||||
or
|
||||
genericCollectionType(return, tp) and result = ".Element"
|
||||
@@ -111,7 +110,7 @@ private string getAccess(DotNet::Callable callable, Type return, TypeParameter t
|
||||
* Holds if `input` is a models as data string representation of, how a value of type `tp`
|
||||
* (or a generic parameterized over `tp`) can be generated by a delegate parameter of `callable`.
|
||||
*/
|
||||
private predicate delegateSource(DotNet::Callable callable, string input, TypeParameter tp) {
|
||||
private predicate delegateSource(Callable callable, string input, TypeParameter tp) {
|
||||
exists(DelegateType dt, int position, Type return, string access |
|
||||
delegate(callable, dt, position) and
|
||||
return = dt.getReturnType() and
|
||||
@@ -129,7 +128,7 @@ private predicate delegateSource(DotNet::Callable callable, string input, TypePa
|
||||
* (2) The parameters of `callable`.
|
||||
* (3) Any delegate parameters of `callable`.
|
||||
*/
|
||||
private predicate input(DotNet::Callable callable, string input, TypeParameter tp) {
|
||||
private predicate input(Callable callable, string input, TypeParameter tp) {
|
||||
input = implicit(callable, tp)
|
||||
or
|
||||
parameter(callable, input, tp)
|
||||
@@ -141,7 +140,7 @@ private predicate input(DotNet::Callable callable, string input, TypeParameter t
|
||||
* Holds if `callable` returns a value of type `tp` (or a generic parameterized over `tp`) and `output`
|
||||
* is a models as data string representation of, how data is routed to the return.
|
||||
*/
|
||||
private predicate returns(DotNet::Callable callable, TypeParameter tp, string output) {
|
||||
private predicate returns(Callable callable, TypeParameter tp, string output) {
|
||||
exists(Type return, string access | return = callable.getReturnType() |
|
||||
access = getAccess(callable, return, tp) and
|
||||
output = "ReturnValue" + access
|
||||
@@ -153,7 +152,7 @@ private predicate returns(DotNet::Callable callable, TypeParameter tp, string ou
|
||||
* and `output` is the models as data string representation of, how data is routed to
|
||||
* the delegate parameter.
|
||||
*/
|
||||
private predicate delegateSink(DotNet::Callable callable, TypeParameter tp, string output) {
|
||||
private predicate delegateSink(Callable callable, TypeParameter tp, string output) {
|
||||
exists(DelegateType dt, int position, Parameter p |
|
||||
delegate(callable, dt, position) and
|
||||
p = dt.getAParameter() and
|
||||
@@ -170,7 +169,7 @@ private predicate delegateSink(DotNet::Callable callable, TypeParameter tp, stri
|
||||
* (2) The return of `callable`.
|
||||
* (3) Any delegate parameters of `callable`.
|
||||
*/
|
||||
private predicate output(DotNet::Callable callable, TypeParameter tp, string output) {
|
||||
private predicate output(Callable callable, TypeParameter tp, string output) {
|
||||
output = implicit(callable, tp)
|
||||
or
|
||||
returns(callable, tp, output)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
array.cs:
|
||||
# 2| System.Void ArrayTest.one_dim_init_acc()
|
||||
# 2| ArrayTest.one_dim_init_acc()
|
||||
# 2| Block 0
|
||||
# 2| v2_1(Void) = EnterFunction :
|
||||
# 2| mu2_2(<unknown>) = AliasedDefinition :
|
||||
@@ -54,7 +54,7 @@ array.cs:
|
||||
# 2| v2_5(Void) = AliasedUse : ~m?
|
||||
# 2| v2_6(Void) = ExitFunction :
|
||||
|
||||
# 13| System.Void ArrayTest.twod_and_init_acc()
|
||||
# 13| ArrayTest.twod_and_init_acc()
|
||||
# 13| Block 0
|
||||
# 13| v13_1(Void) = EnterFunction :
|
||||
# 13| mu13_2(<unknown>) = AliasedDefinition :
|
||||
@@ -145,7 +145,7 @@ array.cs:
|
||||
# 13| v13_6(Void) = ExitFunction :
|
||||
|
||||
assignop.cs:
|
||||
# 5| System.Void AssignOp.Main()
|
||||
# 5| AssignOp.Main()
|
||||
# 5| Block 0
|
||||
# 5| v5_1(Void) = EnterFunction :
|
||||
# 5| mu5_2(<unknown>) = AliasedDefinition :
|
||||
@@ -220,7 +220,7 @@ assignop.cs:
|
||||
# 5| v5_5(Void) = ExitFunction :
|
||||
|
||||
casts.cs:
|
||||
# 11| System.Void Casts.Main()
|
||||
# 11| Casts.Main()
|
||||
# 11| Block 0
|
||||
# 11| v11_1(Void) = EnterFunction :
|
||||
# 11| mu11_2(<unknown>) = AliasedDefinition :
|
||||
@@ -245,7 +245,7 @@ casts.cs:
|
||||
# 11| v11_5(Void) = ExitFunction :
|
||||
|
||||
collections.cs:
|
||||
# 11| System.Void Collections.Main()
|
||||
# 11| Collections.Main()
|
||||
# 11| Block 0
|
||||
# 11| v11_1(Void) = EnterFunction :
|
||||
# 11| mu11_2(<unknown>) = AliasedDefinition :
|
||||
@@ -288,7 +288,7 @@ collections.cs:
|
||||
# 11| v11_5(Void) = ExitFunction :
|
||||
|
||||
constructor_init.cs:
|
||||
# 5| System.Void BaseClass..ctor()
|
||||
# 5| BaseClass.BaseClass()
|
||||
# 5| Block 0
|
||||
# 5| v5_1(Void) = EnterFunction :
|
||||
# 5| mu5_2(<unknown>) = AliasedDefinition :
|
||||
@@ -302,7 +302,7 @@ constructor_init.cs:
|
||||
# 5| v5_9(Void) = AliasedUse : ~m?
|
||||
# 5| v5_10(Void) = ExitFunction :
|
||||
|
||||
# 9| System.Void BaseClass..ctor(System.Int32)
|
||||
# 9| BaseClass.BaseClass(int)
|
||||
# 9| Block 0
|
||||
# 9| v9_1(Void) = EnterFunction :
|
||||
# 9| mu9_2(<unknown>) = AliasedDefinition :
|
||||
@@ -322,7 +322,7 @@ constructor_init.cs:
|
||||
# 9| v9_11(Void) = AliasedUse : ~m?
|
||||
# 9| v9_12(Void) = ExitFunction :
|
||||
|
||||
# 17| System.Void DerivedClass..ctor()
|
||||
# 17| DerivedClass.DerivedClass()
|
||||
# 17| Block 0
|
||||
# 17| v17_1(Void) = EnterFunction :
|
||||
# 17| mu17_2(<unknown>) = AliasedDefinition :
|
||||
@@ -336,7 +336,7 @@ constructor_init.cs:
|
||||
# 17| v17_9(Void) = AliasedUse : ~m?
|
||||
# 17| v17_10(Void) = ExitFunction :
|
||||
|
||||
# 21| System.Void DerivedClass..ctor(System.Int32)
|
||||
# 21| DerivedClass.DerivedClass(int)
|
||||
# 21| Block 0
|
||||
# 21| v21_1(Void) = EnterFunction :
|
||||
# 21| mu21_2(<unknown>) = AliasedDefinition :
|
||||
@@ -354,7 +354,7 @@ constructor_init.cs:
|
||||
# 21| v21_13(Void) = AliasedUse : ~m?
|
||||
# 21| v21_14(Void) = ExitFunction :
|
||||
|
||||
# 25| System.Void DerivedClass..ctor(System.Int32,System.Int32)
|
||||
# 25| DerivedClass.DerivedClass(int, int)
|
||||
# 25| Block 0
|
||||
# 25| v25_1(Void) = EnterFunction :
|
||||
# 25| mu25_2(<unknown>) = AliasedDefinition :
|
||||
@@ -373,7 +373,7 @@ constructor_init.cs:
|
||||
# 25| v25_14(Void) = AliasedUse : ~m?
|
||||
# 25| v25_15(Void) = ExitFunction :
|
||||
|
||||
# 29| System.Void DerivedClass.Main()
|
||||
# 29| DerivedClass.Main()
|
||||
# 29| Block 0
|
||||
# 29| v29_1(Void) = EnterFunction :
|
||||
# 29| mu29_2(<unknown>) = AliasedDefinition :
|
||||
@@ -403,7 +403,7 @@ constructor_init.cs:
|
||||
# 29| v29_5(Void) = ExitFunction :
|
||||
|
||||
crement.cs:
|
||||
# 3| System.Void CrementOpsTest.Main()
|
||||
# 3| CrementOpsTest.Main()
|
||||
# 3| Block 0
|
||||
# 3| v3_1(Void) = EnterFunction :
|
||||
# 3| mu3_2(<unknown>) = AliasedDefinition :
|
||||
@@ -443,7 +443,7 @@ crement.cs:
|
||||
# 3| v3_5(Void) = ExitFunction :
|
||||
|
||||
delegates.cs:
|
||||
# 6| System.Int32 Delegates.returns(System.Int32)
|
||||
# 6| Delegates.returns(int)
|
||||
# 6| Block 0
|
||||
# 6| v6_1(Void) = EnterFunction :
|
||||
# 6| mu6_2(<unknown>) = AliasedDefinition :
|
||||
@@ -458,7 +458,7 @@ delegates.cs:
|
||||
# 6| v6_7(Void) = AliasedUse : ~m?
|
||||
# 6| v6_8(Void) = ExitFunction :
|
||||
|
||||
# 11| System.Void Delegates.Main()
|
||||
# 11| Delegates.Main()
|
||||
# 11| Block 0
|
||||
# 11| v11_1(Void) = EnterFunction :
|
||||
# 11| mu11_2(<unknown>) = AliasedDefinition :
|
||||
@@ -480,7 +480,7 @@ delegates.cs:
|
||||
# 11| v11_5(Void) = ExitFunction :
|
||||
|
||||
events.cs:
|
||||
# 8| System.Void Events..ctor()
|
||||
# 8| Events.Events()
|
||||
# 8| Block 0
|
||||
# 8| v8_1(Void) = EnterFunction :
|
||||
# 8| mu8_2(<unknown>) = AliasedDefinition :
|
||||
@@ -501,7 +501,7 @@ events.cs:
|
||||
# 8| v8_9(Void) = AliasedUse : ~m?
|
||||
# 8| v8_10(Void) = ExitFunction :
|
||||
|
||||
# 13| System.Void Events.AddEvent()
|
||||
# 13| Events.AddEvent()
|
||||
# 13| Block 0
|
||||
# 13| v13_1(Void) = EnterFunction :
|
||||
# 13| mu13_2(<unknown>) = AliasedDefinition :
|
||||
@@ -517,7 +517,7 @@ events.cs:
|
||||
# 13| v13_5(Void) = AliasedUse : ~m?
|
||||
# 13| v13_6(Void) = ExitFunction :
|
||||
|
||||
# 18| System.Void Events.RemoveEvent()
|
||||
# 18| Events.RemoveEvent()
|
||||
# 18| Block 0
|
||||
# 18| v18_1(Void) = EnterFunction :
|
||||
# 18| mu18_2(<unknown>) = AliasedDefinition :
|
||||
@@ -533,7 +533,7 @@ events.cs:
|
||||
# 18| v18_5(Void) = AliasedUse : ~m?
|
||||
# 18| v18_6(Void) = ExitFunction :
|
||||
|
||||
# 23| System.String Events.Fun(System.String)
|
||||
# 23| Events.Fun(string)
|
||||
# 23| Block 0
|
||||
# 23| v23_1(Void) = EnterFunction :
|
||||
# 23| mu23_2(<unknown>) = AliasedDefinition :
|
||||
@@ -549,7 +549,7 @@ events.cs:
|
||||
# 23| v23_8(Void) = AliasedUse : ~m?
|
||||
# 23| v23_9(Void) = ExitFunction :
|
||||
|
||||
# 28| System.Void Events.Main(System.String[])
|
||||
# 28| Events.Main(String[])
|
||||
# 28| Block 0
|
||||
# 28| v28_1(Void) = EnterFunction :
|
||||
# 28| mu28_2(<unknown>) = AliasedDefinition :
|
||||
@@ -584,7 +584,7 @@ events.cs:
|
||||
# 28| v28_7(Void) = ExitFunction :
|
||||
|
||||
foreach.cs:
|
||||
# 4| System.Void ForEach.Main()
|
||||
# 4| ForEach.Main()
|
||||
# 4| Block 0
|
||||
# 4| v4_1(Void) = EnterFunction :
|
||||
# 4| mu4_2(<unknown>) = AliasedDefinition :
|
||||
@@ -662,7 +662,7 @@ foreach.cs:
|
||||
# 4| v4_5(Void) = ExitFunction :
|
||||
|
||||
func_with_param_call.cs:
|
||||
# 5| System.Int32 test_call_with_param.f(System.Int32,System.Int32)
|
||||
# 5| test_call_with_param.f(int, int)
|
||||
# 5| Block 0
|
||||
# 5| v5_1(Void) = EnterFunction :
|
||||
# 5| mu5_2(<unknown>) = AliasedDefinition :
|
||||
@@ -682,7 +682,7 @@ func_with_param_call.cs:
|
||||
# 5| v5_9(Void) = AliasedUse : ~m?
|
||||
# 5| v5_10(Void) = ExitFunction :
|
||||
|
||||
# 10| System.Int32 test_call_with_param.g()
|
||||
# 10| test_call_with_param.g()
|
||||
# 10| Block 0
|
||||
# 10| v10_1(Void) = EnterFunction :
|
||||
# 10| mu10_2(<unknown>) = AliasedDefinition :
|
||||
@@ -699,7 +699,7 @@ func_with_param_call.cs:
|
||||
# 10| v10_6(Void) = ExitFunction :
|
||||
|
||||
indexers.cs:
|
||||
# 8| System.String Indexers.MyClass.get_Item(System.Int32)
|
||||
# 8| Indexers+MyClass.get_Item(int)
|
||||
# 8| Block 0
|
||||
# 8| v8_1(Void) = EnterFunction :
|
||||
# 8| mu8_2(<unknown>) = AliasedDefinition :
|
||||
@@ -720,7 +720,7 @@ indexers.cs:
|
||||
# 8| v8_6(Void) = AliasedUse : ~m?
|
||||
# 8| v8_7(Void) = ExitFunction :
|
||||
|
||||
# 12| System.Void Indexers.MyClass.set_Item(System.Int32,System.String)
|
||||
# 12| Indexers+MyClass.set_Item(int, string)
|
||||
# 12| Block 0
|
||||
# 12| v12_1(Void) = EnterFunction :
|
||||
# 12| mu12_2(<unknown>) = AliasedDefinition :
|
||||
@@ -742,7 +742,7 @@ indexers.cs:
|
||||
# 12| v12_7(Void) = AliasedUse : ~m?
|
||||
# 12| v12_8(Void) = ExitFunction :
|
||||
|
||||
# 19| System.Void Indexers.Main()
|
||||
# 19| Indexers.Main()
|
||||
# 19| Block 0
|
||||
# 19| v19_1(Void) = EnterFunction :
|
||||
# 19| mu19_2(<unknown>) = AliasedDefinition :
|
||||
@@ -783,7 +783,7 @@ indexers.cs:
|
||||
# 19| v19_5(Void) = ExitFunction :
|
||||
|
||||
inheritance_polymorphism.cs:
|
||||
# 3| System.Int32 A.function()
|
||||
# 3| A.function()
|
||||
# 3| Block 0
|
||||
# 3| v3_1(Void) = EnterFunction :
|
||||
# 3| mu3_2(<unknown>) = AliasedDefinition :
|
||||
@@ -796,7 +796,7 @@ inheritance_polymorphism.cs:
|
||||
# 3| v3_6(Void) = AliasedUse : ~m?
|
||||
# 3| v3_7(Void) = ExitFunction :
|
||||
|
||||
# 15| System.Int32 C.function()
|
||||
# 15| C.function()
|
||||
# 15| Block 0
|
||||
# 15| v15_1(Void) = EnterFunction :
|
||||
# 15| mu15_2(<unknown>) = AliasedDefinition :
|
||||
@@ -809,7 +809,7 @@ inheritance_polymorphism.cs:
|
||||
# 15| v15_6(Void) = AliasedUse : ~m?
|
||||
# 15| v15_7(Void) = ExitFunction :
|
||||
|
||||
# 23| System.Void Program.Main()
|
||||
# 23| Program.Main()
|
||||
# 23| Block 0
|
||||
# 23| v23_1(Void) = EnterFunction :
|
||||
# 23| mu23_2(<unknown>) = AliasedDefinition :
|
||||
@@ -853,7 +853,7 @@ inheritance_polymorphism.cs:
|
||||
# 23| v23_5(Void) = ExitFunction :
|
||||
|
||||
inoutref.cs:
|
||||
# 11| System.Void InOutRef.set(MyClass,MyClass)
|
||||
# 11| InOutRef.set(ref MyClass, MyClass)
|
||||
# 11| Block 0
|
||||
# 11| v11_1(Void) = EnterFunction :
|
||||
# 11| mu11_2(<unknown>) = AliasedDefinition :
|
||||
@@ -870,7 +870,7 @@ inoutref.cs:
|
||||
# 11| v11_8(Void) = AliasedUse : ~m?
|
||||
# 11| v11_9(Void) = ExitFunction :
|
||||
|
||||
# 16| System.Void InOutRef.F(System.Int32,MyStruct,MyStruct,MyClass,MyClass)
|
||||
# 16| InOutRef.F(ref int, ref MyStruct, MyStruct, ref MyClass, MyClass)
|
||||
# 16| Block 0
|
||||
# 16| v16_1(Void) = EnterFunction :
|
||||
# 16| mu16_2(<unknown>) = AliasedDefinition :
|
||||
@@ -928,7 +928,7 @@ inoutref.cs:
|
||||
# 16| v16_14(Void) = AliasedUse : ~m?
|
||||
# 16| v16_15(Void) = ExitFunction :
|
||||
|
||||
# 29| System.Void InOutRef.Main()
|
||||
# 29| InOutRef.Main()
|
||||
# 29| Block 0
|
||||
# 29| v29_1(Void) = EnterFunction :
|
||||
# 29| mu29_2(<unknown>) = AliasedDefinition :
|
||||
@@ -966,7 +966,7 @@ inoutref.cs:
|
||||
# 29| v29_5(Void) = ExitFunction :
|
||||
|
||||
isexpr.cs:
|
||||
# 8| System.Void IsExpr.Main()
|
||||
# 8| IsExpr.Main()
|
||||
# 8| Block 0
|
||||
# 8| v8_1(Void) = EnterFunction :
|
||||
# 8| mu8_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1028,7 +1028,7 @@ isexpr.cs:
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
jumps.cs:
|
||||
# 5| System.Void Jumps.Main()
|
||||
# 5| Jumps.Main()
|
||||
# 5| Block 0
|
||||
# 5| v5_1(Void) = EnterFunction :
|
||||
# 5| mu5_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1201,7 +1201,7 @@ jumps.cs:
|
||||
# 5| v5_5(Void) = ExitFunction :
|
||||
|
||||
lock.cs:
|
||||
# 5| System.Void LockTest.A()
|
||||
# 5| LockTest.A()
|
||||
# 5| Block 0
|
||||
# 5| v5_1(Void) = EnterFunction :
|
||||
# 5| mu5_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1252,7 +1252,7 @@ lock.cs:
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
obj_creation.cs:
|
||||
# 7| System.Void ObjCreation.MyClass..ctor()
|
||||
# 7| ObjCreation+MyClass.MyClass()
|
||||
# 7| Block 0
|
||||
# 7| v7_1(Void) = EnterFunction :
|
||||
# 7| mu7_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1266,7 +1266,7 @@ obj_creation.cs:
|
||||
# 7| v7_9(Void) = AliasedUse : ~m?
|
||||
# 7| v7_10(Void) = ExitFunction :
|
||||
|
||||
# 11| System.Void ObjCreation.MyClass..ctor(System.Int32)
|
||||
# 11| ObjCreation+MyClass.MyClass(int)
|
||||
# 11| Block 0
|
||||
# 11| v11_1(Void) = EnterFunction :
|
||||
# 11| mu11_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1286,7 +1286,7 @@ obj_creation.cs:
|
||||
# 11| v11_11(Void) = AliasedUse : ~m?
|
||||
# 11| v11_12(Void) = ExitFunction :
|
||||
|
||||
# 17| System.Void ObjCreation.SomeFun(ObjCreation.MyClass)
|
||||
# 17| ObjCreation.SomeFun(MyClass)
|
||||
# 17| Block 0
|
||||
# 17| v17_1(Void) = EnterFunction :
|
||||
# 17| mu17_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1297,7 +1297,7 @@ obj_creation.cs:
|
||||
# 17| v17_6(Void) = AliasedUse : ~m?
|
||||
# 17| v17_7(Void) = ExitFunction :
|
||||
|
||||
# 21| System.Void ObjCreation.Main()
|
||||
# 21| ObjCreation.Main()
|
||||
# 21| Block 0
|
||||
# 21| v21_1(Void) = EnterFunction :
|
||||
# 21| mu21_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1336,7 +1336,7 @@ obj_creation.cs:
|
||||
# 21| v21_5(Void) = ExitFunction :
|
||||
|
||||
pointers.cs:
|
||||
# 3| System.Void Pointers.addone(System.Int32[])
|
||||
# 3| Pointers.addone(Int32[])
|
||||
# 3| Block 0
|
||||
# 3| v3_1(Void) = EnterFunction :
|
||||
# 3| mu3_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1395,7 +1395,7 @@ pointers.cs:
|
||||
# 9| mu9_14(Int32) = Store[i] : &:r9_10, r9_13
|
||||
#-----| Goto (back edge) -> Block 2
|
||||
|
||||
# 25| System.Void Pointers.Main()
|
||||
# 25| Pointers.Main()
|
||||
# 25| Block 0
|
||||
# 25| v25_1(Void) = EnterFunction :
|
||||
# 25| mu25_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1463,7 +1463,7 @@ pointers.cs:
|
||||
# 25| v25_5(Void) = ExitFunction :
|
||||
|
||||
prop.cs:
|
||||
# 7| System.Int32 PropClass.get_Prop()
|
||||
# 7| PropClass.get_Prop()
|
||||
# 7| Block 0
|
||||
# 7| v7_1(Void) = EnterFunction :
|
||||
# 7| mu7_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1479,7 +1479,7 @@ prop.cs:
|
||||
# 7| v7_6(Void) = AliasedUse : ~m?
|
||||
# 7| v7_7(Void) = ExitFunction :
|
||||
|
||||
# 12| System.Void PropClass.set_Prop(System.Int32)
|
||||
# 12| PropClass.set_Prop(int)
|
||||
# 12| Block 0
|
||||
# 12| v12_1(Void) = EnterFunction :
|
||||
# 12| mu12_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1494,7 +1494,7 @@ prop.cs:
|
||||
# 12| v12_7(Void) = AliasedUse : ~m?
|
||||
# 12| v12_8(Void) = ExitFunction :
|
||||
|
||||
# 18| System.Int32 PropClass.func()
|
||||
# 18| PropClass.func()
|
||||
# 18| Block 0
|
||||
# 18| v18_1(Void) = EnterFunction :
|
||||
# 18| mu18_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1507,7 +1507,7 @@ prop.cs:
|
||||
# 18| v18_6(Void) = AliasedUse : ~m?
|
||||
# 18| v18_7(Void) = ExitFunction :
|
||||
|
||||
# 26| System.Void Prog.Main()
|
||||
# 26| Prog.Main()
|
||||
# 26| Block 0
|
||||
# 26| v26_1(Void) = EnterFunction :
|
||||
# 26| mu26_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1535,7 +1535,7 @@ prop.cs:
|
||||
# 26| v26_5(Void) = ExitFunction :
|
||||
|
||||
simple_call.cs:
|
||||
# 5| System.Int32 test_simple_call.f()
|
||||
# 5| test_simple_call.f()
|
||||
# 5| Block 0
|
||||
# 5| v5_1(Void) = EnterFunction :
|
||||
# 5| mu5_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1547,7 +1547,7 @@ simple_call.cs:
|
||||
# 5| v5_5(Void) = AliasedUse : ~m?
|
||||
# 5| v5_6(Void) = ExitFunction :
|
||||
|
||||
# 10| System.Int32 test_simple_call.g()
|
||||
# 10| test_simple_call.g()
|
||||
# 10| Block 0
|
||||
# 10| v10_1(Void) = EnterFunction :
|
||||
# 10| mu10_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1563,7 +1563,7 @@ simple_call.cs:
|
||||
# 10| v10_7(Void) = ExitFunction :
|
||||
|
||||
simple_function.cs:
|
||||
# 5| System.Int32 test_simple_function.f()
|
||||
# 5| test_simple_function.f()
|
||||
# 5| Block 0
|
||||
# 5| v5_1(Void) = EnterFunction :
|
||||
# 5| mu5_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1576,7 +1576,7 @@ simple_function.cs:
|
||||
# 5| v5_6(Void) = ExitFunction :
|
||||
|
||||
stmts.cs:
|
||||
# 5| System.Int32 test_stmts.ifStmt(System.Int32)
|
||||
# 5| test_stmts.ifStmt(int)
|
||||
# 5| Block 0
|
||||
# 5| v5_1(Void) = EnterFunction :
|
||||
# 5| mu5_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1608,7 +1608,7 @@ stmts.cs:
|
||||
# 10| mu10_3(Int32) = Store[#return] : &:r10_1, r10_2
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
# 13| System.Void test_stmts.whileStmt(System.Int32)
|
||||
# 13| test_stmts.whileStmt(int)
|
||||
# 13| Block 0
|
||||
# 13| v13_1(Void) = EnterFunction :
|
||||
# 13| mu13_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1642,7 +1642,7 @@ stmts.cs:
|
||||
# 18| mu18_6(Int32) = Store[x] : &:r18_5, r18_4
|
||||
#-----| Goto (back edge) -> Block 2
|
||||
|
||||
# 22| System.Int32 test_stmts.switchStmt()
|
||||
# 22| test_stmts.switchStmt()
|
||||
# 22| Block 0
|
||||
# 22| v22_1(Void) = EnterFunction :
|
||||
# 22| mu22_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1707,7 +1707,7 @@ stmts.cs:
|
||||
# 40| mu40_4(Int32) = Store[#return] : &:r40_1, r40_3
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
# 45| System.Void test_stmts.tryCatchFinally()
|
||||
# 45| test_stmts.tryCatchFinally()
|
||||
# 45| Block 0
|
||||
# 45| v45_1(Void) = EnterFunction :
|
||||
# 45| mu45_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1771,7 +1771,7 @@ stmts.cs:
|
||||
# 60| v60_1(Void) = ReThrow :
|
||||
#-----| Exception -> Block 2
|
||||
|
||||
# 68| System.Void test_stmts.forStmt()
|
||||
# 68| test_stmts.forStmt()
|
||||
# 68| Block 0
|
||||
# 68| v68_1(Void) = EnterFunction :
|
||||
# 68| mu68_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1853,7 +1853,7 @@ stmts.cs:
|
||||
# 83| v83_1(Void) = NoOp :
|
||||
#-----| Goto (back edge) -> Block 7
|
||||
|
||||
# 88| System.Void test_stmts.doWhile()
|
||||
# 88| test_stmts.doWhile()
|
||||
# 88| Block 0
|
||||
# 88| v88_1(Void) = EnterFunction :
|
||||
# 88| mu88_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1882,7 +1882,7 @@ stmts.cs:
|
||||
#-----| False -> Block 1
|
||||
#-----| True (back edge) -> Block 2
|
||||
|
||||
# 98| System.Void test_stmts.checkedUnchecked()
|
||||
# 98| test_stmts.checkedUnchecked()
|
||||
# 98| Block 0
|
||||
# 98| v98_1(Void) = EnterFunction :
|
||||
# 98| mu98_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1907,7 +1907,7 @@ stmts.cs:
|
||||
# 98| v98_5(Void) = ExitFunction :
|
||||
|
||||
using.cs:
|
||||
# 7| System.Void UsingStmt.MyDisposable..ctor()
|
||||
# 7| UsingStmt+MyDisposable.MyDisposable()
|
||||
# 7| Block 0
|
||||
# 7| v7_1(Void) = EnterFunction :
|
||||
# 7| mu7_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1921,7 +1921,7 @@ using.cs:
|
||||
# 7| v7_10(Void) = AliasedUse : ~m?
|
||||
# 7| v7_11(Void) = ExitFunction :
|
||||
|
||||
# 8| System.Void UsingStmt.MyDisposable.DoSomething()
|
||||
# 8| UsingStmt+MyDisposable.DoSomething()
|
||||
# 8| Block 0
|
||||
# 8| v8_1(Void) = EnterFunction :
|
||||
# 8| mu8_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1931,7 +1931,7 @@ using.cs:
|
||||
# 8| v8_6(Void) = AliasedUse : ~m?
|
||||
# 8| v8_7(Void) = ExitFunction :
|
||||
|
||||
# 9| System.Void UsingStmt.MyDisposable.Dispose()
|
||||
# 9| UsingStmt+MyDisposable.Dispose()
|
||||
# 9| Block 0
|
||||
# 9| v9_1(Void) = EnterFunction :
|
||||
# 9| mu9_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1941,7 +1941,7 @@ using.cs:
|
||||
# 9| v9_6(Void) = AliasedUse : ~m?
|
||||
# 9| v9_7(Void) = ExitFunction :
|
||||
|
||||
# 12| System.Void UsingStmt.Main()
|
||||
# 12| UsingStmt.Main()
|
||||
# 12| Block 0
|
||||
# 12| v12_1(Void) = EnterFunction :
|
||||
# 12| mu12_2(<unknown>) = AliasedDefinition :
|
||||
@@ -1983,7 +1983,7 @@ using.cs:
|
||||
# 12| v12_5(Void) = ExitFunction :
|
||||
|
||||
variables.cs:
|
||||
# 5| System.Void test_variables.f()
|
||||
# 5| test_variables.f()
|
||||
# 5| Block 0
|
||||
# 5| v5_1(Void) = EnterFunction :
|
||||
# 5| mu5_2(<unknown>) = AliasedDefinition :
|
||||
|
||||
@@ -12,7 +12,11 @@ unnecessaryPhiInstruction
|
||||
memoryOperandDefinitionIsUnmodeled
|
||||
operandAcrossFunctions
|
||||
instructionWithoutUniqueBlock
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
containsLoopOfForwardEdges
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
lostReachability
|
||||
backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
@@ -22,14 +26,10 @@ wronglyMarkedAsConflated
|
||||
invalidOverlap
|
||||
nonUniqueEnclosingIRFunction
|
||||
fieldAddressOnNonPointer
|
||||
| inoutref.cs:18:9:18:13 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | inoutref.cs:16:17:16:17 | System.Void InOutRef.F(System.Int32,MyStruct,MyStruct,MyClass,MyClass) | System.Void InOutRef.F(System.Int32,MyStruct,MyStruct,MyClass,MyClass) |
|
||||
| inoutref.cs:19:13:19:17 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | inoutref.cs:16:17:16:17 | System.Void InOutRef.F(System.Int32,MyStruct,MyStruct,MyClass,MyClass) | System.Void InOutRef.F(System.Int32,MyStruct,MyStruct,MyClass,MyClass) |
|
||||
| pointers.cs:35:17:35:24 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | pointers.cs:25:17:25:20 | System.Void Pointers.Main() | System.Void Pointers.Main() |
|
||||
| inoutref.cs:18:9:18:13 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | inoutref.cs:16:17:16:17 | InOutRef.F(ref int, ref MyStruct, MyStruct, ref MyClass, MyClass) | InOutRef.F(ref int, ref MyStruct, MyStruct, ref MyClass, MyClass) |
|
||||
| inoutref.cs:19:13:19:17 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | inoutref.cs:16:17:16:17 | InOutRef.F(ref int, ref MyStruct, MyStruct, ref MyClass, MyClass) | InOutRef.F(ref int, ref MyStruct, MyStruct, ref MyClass, MyClass) |
|
||||
| pointers.cs:35:17:35:24 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | pointers.cs:25:17:25:20 | Pointers.Main() | Pointers.Main() |
|
||||
thisArgumentIsNonPointer
|
||||
| inoutref.cs:32:22:32:35 | Call: object creation of type MyStruct | Call instruction 'Call: object creation of type MyStruct' has a `this` argument operand that is not an address, in function '$@'. | inoutref.cs:29:17:29:20 | System.Void InOutRef.Main() | System.Void InOutRef.Main() |
|
||||
| pointers.cs:27:22:27:35 | Call: object creation of type MyStruct | Call instruction 'Call: object creation of type MyStruct' has a `this` argument operand that is not an address, in function '$@'. | pointers.cs:25:17:25:20 | System.Void Pointers.Main() | System.Void Pointers.Main() |
|
||||
| inoutref.cs:32:22:32:35 | Call: object creation of type MyStruct | Call instruction 'Call: object creation of type MyStruct' has a `this` argument operand that is not an address, in function '$@'. | inoutref.cs:29:17:29:20 | InOutRef.Main() | InOutRef.Main() |
|
||||
| pointers.cs:27:22:27:35 | Call: object creation of type MyStruct | Call instruction 'Call: object creation of type MyStruct' has a `this` argument operand that is not an address, in function '$@'. | pointers.cs:25:17:25:20 | Pointers.Main() | Pointers.Main() |
|
||||
nonUniqueIRVariable
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
@@ -12,7 +12,11 @@ unnecessaryPhiInstruction
|
||||
memoryOperandDefinitionIsUnmodeled
|
||||
operandAcrossFunctions
|
||||
instructionWithoutUniqueBlock
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
containsLoopOfForwardEdges
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
lostReachability
|
||||
backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
@@ -22,14 +26,10 @@ wronglyMarkedAsConflated
|
||||
invalidOverlap
|
||||
nonUniqueEnclosingIRFunction
|
||||
fieldAddressOnNonPointer
|
||||
| inoutref.cs:18:9:18:13 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | inoutref.cs:16:17:16:17 | System.Void InOutRef.F(System.Int32,MyStruct,MyStruct,MyClass,MyClass) | System.Void InOutRef.F(System.Int32,MyStruct,MyStruct,MyClass,MyClass) |
|
||||
| inoutref.cs:19:13:19:17 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | inoutref.cs:16:17:16:17 | System.Void InOutRef.F(System.Int32,MyStruct,MyStruct,MyClass,MyClass) | System.Void InOutRef.F(System.Int32,MyStruct,MyStruct,MyClass,MyClass) |
|
||||
| pointers.cs:35:17:35:24 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | pointers.cs:25:17:25:20 | System.Void Pointers.Main() | System.Void Pointers.Main() |
|
||||
| inoutref.cs:18:9:18:13 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | inoutref.cs:16:17:16:17 | InOutRef.F(ref int, ref MyStruct, MyStruct, ref MyClass, MyClass) | InOutRef.F(ref int, ref MyStruct, MyStruct, ref MyClass, MyClass) |
|
||||
| inoutref.cs:19:13:19:17 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | inoutref.cs:16:17:16:17 | InOutRef.F(ref int, ref MyStruct, MyStruct, ref MyClass, MyClass) | InOutRef.F(ref int, ref MyStruct, MyStruct, ref MyClass, MyClass) |
|
||||
| pointers.cs:35:17:35:24 | FieldAddress: access to field fld | FieldAddress instruction 'FieldAddress: access to field fld' has an object address operand that is not an address, in function '$@'. | pointers.cs:25:17:25:20 | Pointers.Main() | Pointers.Main() |
|
||||
thisArgumentIsNonPointer
|
||||
| inoutref.cs:32:22:32:35 | Call: object creation of type MyStruct | Call instruction 'Call: object creation of type MyStruct' has a `this` argument operand that is not an address, in function '$@'. | inoutref.cs:29:17:29:20 | System.Void InOutRef.Main() | System.Void InOutRef.Main() |
|
||||
| pointers.cs:27:22:27:35 | Call: object creation of type MyStruct | Call instruction 'Call: object creation of type MyStruct' has a `this` argument operand that is not an address, in function '$@'. | pointers.cs:25:17:25:20 | System.Void Pointers.Main() | System.Void Pointers.Main() |
|
||||
| inoutref.cs:32:22:32:35 | Call: object creation of type MyStruct | Call instruction 'Call: object creation of type MyStruct' has a `this` argument operand that is not an address, in function '$@'. | inoutref.cs:29:17:29:20 | InOutRef.Main() | InOutRef.Main() |
|
||||
| pointers.cs:27:22:27:35 | Call: object creation of type MyStruct | Call instruction 'Call: object creation of type MyStruct' has a `this` argument operand that is not an address, in function '$@'. | pointers.cs:25:17:25:20 | Pointers.Main() | Pointers.Main() |
|
||||
nonUniqueIRVariable
|
||||
missingCanonicalLanguageType
|
||||
multipleCanonicalLanguageTypes
|
||||
missingIRType
|
||||
multipleIRTypes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import semmle.code.cil.Attribute
|
||||
import semmle.code.cil.Declaration
|
||||
|
||||
private predicate isOsSpecific(Declaration d) {
|
||||
deprecated private predicate isOsSpecific(Declaration d) {
|
||||
d.getFullyQualifiedName()
|
||||
.matches("%" +
|
||||
[
|
||||
@@ -13,7 +13,7 @@ private predicate isOsSpecific(Declaration d) {
|
||||
] + "%")
|
||||
}
|
||||
|
||||
query predicate attrNoArg(string dec, string attr) {
|
||||
deprecated query predicate attrNoArg(string dec, string attr) {
|
||||
exists(Declaration d, Attribute a |
|
||||
not isOsSpecific(d) and
|
||||
a.getDeclaration() = d and
|
||||
@@ -24,7 +24,7 @@ query predicate attrNoArg(string dec, string attr) {
|
||||
)
|
||||
}
|
||||
|
||||
query predicate attrArgNamed(string dec, string attr, string name, string value) {
|
||||
deprecated query predicate attrArgNamed(string dec, string attr, string name, string value) {
|
||||
exists(Declaration d, Attribute a |
|
||||
a.getDeclaration() = d and
|
||||
not isOsSpecific(d) and
|
||||
@@ -35,7 +35,7 @@ query predicate attrArgNamed(string dec, string attr, string name, string value)
|
||||
)
|
||||
}
|
||||
|
||||
query predicate attrArgPositional(string dec, string attr, int index, string value) {
|
||||
deprecated query predicate attrArgPositional(string dec, string attr, int index, string value) {
|
||||
exists(Declaration d, Attribute a |
|
||||
a.getDeclaration() = d and
|
||||
not isOsSpecific(d) and
|
||||
|
||||
@@ -3,7 +3,7 @@ import cil
|
||||
import dotnet
|
||||
import semmle.code.csharp.commons.QualifiedName
|
||||
|
||||
class MetadataEntity extends DotNet::NamedElement, @metadata_entity {
|
||||
deprecated class MetadataEntity extends DotNet::NamedElement, @metadata_entity {
|
||||
int getHandle() { metadata_handle(this, _, result) }
|
||||
|
||||
predicate hasHandle() { exists(this.getHandle()) }
|
||||
@@ -11,7 +11,7 @@ class MetadataEntity extends DotNet::NamedElement, @metadata_entity {
|
||||
Assembly getAssembly() { metadata_handle(this, result, _) }
|
||||
}
|
||||
|
||||
query predicate tooManyHandles(string s) {
|
||||
deprecated query predicate tooManyHandles(string s) {
|
||||
exists(MetadataEntity e, Assembly a, string qualifier, string name |
|
||||
strictcount(int handle | metadata_handle(e, a, handle)) > 1 and
|
||||
e.hasFullyQualifiedName(qualifier, name) and
|
||||
@@ -19,7 +19,7 @@ query predicate tooManyHandles(string s) {
|
||||
)
|
||||
}
|
||||
|
||||
private class UniqueMetadataEntity extends MetadataEntity {
|
||||
deprecated private class UniqueMetadataEntity extends MetadataEntity {
|
||||
UniqueMetadataEntity() {
|
||||
// Tuple types such as `(,)` and `ValueTuple`2` share the same handle
|
||||
not this instanceof TupleType and
|
||||
@@ -30,7 +30,7 @@ private class UniqueMetadataEntity extends MetadataEntity {
|
||||
}
|
||||
}
|
||||
|
||||
query predicate tooManyMatchingHandles(string s) {
|
||||
deprecated query predicate tooManyMatchingHandles(string s) {
|
||||
exists(UniqueMetadataEntity e, Assembly a, int handle, string qualifier, string name |
|
||||
metadata_handle(e, a, handle) and
|
||||
strictcount(UniqueMetadataEntity e2 | metadata_handle(e2, a, handle)) > 2 and
|
||||
@@ -39,7 +39,7 @@ query predicate tooManyMatchingHandles(string s) {
|
||||
)
|
||||
}
|
||||
|
||||
query predicate missingCil(Element e) {
|
||||
deprecated query predicate missingCil(Element e) {
|
||||
(
|
||||
e instanceof Callable
|
||||
or
|
||||
@@ -52,16 +52,16 @@ query predicate missingCil(Element e) {
|
||||
not exists(CIL::Element ce | ce.(MetadataEntity).matchesHandle(e))
|
||||
}
|
||||
|
||||
query predicate csharpLocationViolation(Element e) {
|
||||
deprecated query predicate csharpLocationViolation(Element e) {
|
||||
e.fromLibrary() and
|
||||
e.(MetadataEntity).hasHandle() and
|
||||
not e.getALocation() = e.(MetadataEntity).getAssembly()
|
||||
}
|
||||
|
||||
query predicate matchingObjectMethods(string s1, string s2) {
|
||||
deprecated query predicate matchingObjectMethods(string s1, string s2) {
|
||||
exists(Callable m1, CIL::Method m2 |
|
||||
m1.getDeclaringType().hasFullyQualifiedName("System", "Object") and
|
||||
m1.matchesHandle(m2) and
|
||||
m1.(DotNet::Callable).matchesHandle(m2) and
|
||||
s1 = m1.toStringWithTypes() and
|
||||
s2 = m2.toStringWithTypes()
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import cil
|
||||
import semmle.code.cil.ConsistencyChecks
|
||||
|
||||
from ConsistencyViolation v
|
||||
select v, v.getMessage()
|
||||
deprecated query predicate consistencyViolation(ConsistencyViolation v, string message) {
|
||||
message = v.getMessage()
|
||||
}
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
stubs
|
||||
alwaysNull
|
||||
| System.Object Dataflow.NullMethods.ReturnsNull2() | 0: ldarg.0, 1: call Dataflow.NullMethods.ReturnsNull, 2: ret |
|
||||
| System.Object Dataflow.NullMethods.ReturnsNull() | 0: ldnull, 1: ret |
|
||||
| System.Object Dataflow.NullMethods.ReturnsNullIndirect() | 0: ldarg.0, 1: call Dataflow.NullMethods.ReturnsNull, 2: ret |
|
||||
| System.Object Dataflow.NullMethods.VirtualReturnsNull() | 0: ldnull, 1: ret |
|
||||
| System.Object Dataflow.NullMethods.get_NullProperty() | 0: ldnull, 1: ret |
|
||||
| System.Object Dataflow.NullMethods.get_VirtualNullProperty() | 0: ldnull, 1: ret |
|
||||
| System.Object System.Collections.EmptyReadOnlyDictionaryInternal.get_Item(System.Object) | 0: ldarg.1, 1: ldstr "key", 2: call System.ArgumentNullException.ThrowIfNull, 3: ldnull, 4: ret |
|
||||
alwaysNonNull
|
||||
| System.ArgumentException System.ThrowHelper.GetAddingDuplicateWithKeyArgumentException(System.Object) |
|
||||
| System.ArgumentException System.ThrowHelper.GetWrongKeyTypeArgumentException(System.Object,System.Type) |
|
||||
| System.ArgumentException System.ThrowHelper.GetWrongValueTypeArgumentException(System.Object,System.Type) |
|
||||
| System.Collections.Generic.KeyNotFoundException System.ThrowHelper.GetKeyNotFoundException(System.Object) |
|
||||
| System.Exception System.ThrowHelper.CreateEndOfFileException() |
|
||||
| System.Exception System.ThrowHelper.GetArraySegmentCtorValidationFailedException(System.Array,System.Int32,System.Int32) |
|
||||
| System.InvalidOperationException System.ThrowHelper.GetInvalidOperationException_EnumCurrent(System.Int32) |
|
||||
| System.Object Dataflow.NonNullMethods.ReturnsNonNull2() |
|
||||
| System.Object Dataflow.NonNullMethods.ReturnsNonNull() |
|
||||
| System.Object Dataflow.NonNullMethods.ReturnsNonNullIndirect() |
|
||||
| System.Object Dataflow.NonNullMethods.get_VirtualNonNull() |
|
||||
| System.Object Dataflow.NonNullMethods.get_VirtualNonNullProperty() |
|
||||
| System.Reflection.AmbiguousMatchException System.ThrowHelper.GetAmbiguousMatchException(System.Attribute) |
|
||||
| System.Reflection.AmbiguousMatchException System.ThrowHelper.GetAmbiguousMatchException(System.Reflection.MemberInfo) |
|
||||
| System.String Dataflow.NonNullMethods.get_NonNullProperty2() |
|
||||
| System.String System.ThrowHelper.GetArgumentName(System.ExceptionArgument) |
|
||||
| System.Text.Encoder System.Text.ASCIIEncoding.GetEncoder() |
|
||||
| System.Text.Encoder System.Text.Encoding.GetEncoder() |
|
||||
| System.Text.Encoder System.Text.Latin1Encoding.GetEncoder() |
|
||||
| System.Text.Encoder System.Text.UTF7Encoding.GetEncoder() |
|
||||
| System.Text.Encoder System.Text.UTF8Encoding.GetEncoder() |
|
||||
| System.Text.Encoder System.Text.UTF32Encoding.GetEncoder() |
|
||||
| System.Text.Encoder System.Text.UnicodeEncoding.GetEncoder() |
|
||||
alwaysThrows
|
||||
| System.Object Dataflow.ThrowingMethods.AlwaysThrows() | System.InvalidOperationException | 0: newobj System.InvalidOperationException..ctor, 1: throw |
|
||||
| System.Object Dataflow.ThrowingMethods.VirtualThrows() | System.Exception | 0: newobj System.Exception..ctor, 1: throw |
|
||||
| System.Object Dataflow.ThrowingMethods.get_ThrowProperty() | System.Exception | 0: newobj System.Exception..ctor, 1: throw |
|
||||
| System.Object Dataflow.ThrowingMethods.get_VirtualThrowProperty() | System.Exception | 0: newobj System.Exception..ctor, 1: throw |
|
||||
| System.Object System.ValueTuple.get_Item(System.Int32) | System.IndexOutOfRangeException | 0: newobj System.IndexOutOfRangeException..ctor, 1: throw |
|
||||
| System.Void System.Reflection.InvokerEmitUtil.ThrowHelper.Throw_NullReference_InvokeNullRefReturned() | System.NullReferenceException | 0: call System.SR.get_NullReference_InvokeNullRefReturned, 1: newobj System.NullReferenceException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ArgumentOutOfRangeException_Enum_Value() | System.ArgumentOutOfRangeException | 0: ldstr "value", 1: call System.SR.get_ArgumentOutOfRange_Enum, 2: newobj System.ArgumentOutOfRangeException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowAccessViolationException() | System.AccessViolationException | 0: newobj System.AccessViolationException..ctor, 1: throw |
|
||||
| System.Void System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException`1(!0) | System.ArgumentException | 0: ldarg.0, 1: box, 2: call System.ThrowHelper.GetAddingDuplicateWithKeyArgumentException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowAggregateException(System.Collections.Generic.List<System.Exception>) | System.AggregateException | 0: ldarg.0, 1: newobj System.AggregateException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_Arg_CannotBeNaN() | System.ArgumentException | 0: call System.SR.get_Arg_CannotBeNaN, 1: newobj System.ArgumentException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_ArgumentNull_TypedRefType() | System.ArgumentNullException | 0: ldstr "value", 1: call System.SR.get_ArgumentNull_TypedRefType, 2: newobj System.ArgumentNullException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_Argument_IncompatibleArrayType() | System.ArgumentException | 0: call System.SR.get_Argument_IncompatibleArrayType, 1: newobj System.ArgumentException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_BadComparer(System.Object) | System.ArgumentException | 0: call System.SR.get_Arg_BogusIComparer, 1: ldarg.0, 2: call System.SR.Format, 3: newobj System.ArgumentException..ctor, 4: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_CannotExtractScalar(System.ExceptionArgument) | System.ArgumentException | 0: ldc.i4.s 31, 1: ldarg.0, 2: call System.ThrowHelper.GetArgumentException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_DestinationTooShort() | System.ArgumentException | 0: call System.SR.get_Argument_DestinationTooShort, 1: ldstr "destination", 2: newobj System.ArgumentException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_HandleNotAsync(System.String) | System.ArgumentException | 0: call System.SR.get_Arg_HandleNotAsync, 1: ldarg.0, 2: newobj System.ArgumentException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_HandleNotSync(System.String) | System.ArgumentException | 0: call System.SR.get_Arg_HandleNotSync, 1: ldarg.0, 2: newobj System.ArgumentException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_InvalidHandle(System.String) | System.ArgumentException | 0: call System.SR.get_Arg_InvalidHandle, 1: ldarg.0, 2: newobj System.ArgumentException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_OverlapAlignmentMismatch() | System.ArgumentException | 0: call System.SR.get_Argument_OverlapAlignmentMismatch, 1: newobj System.ArgumentException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentException_TupleIncorrectType(System.Object) | System.ArgumentException | 0: call System.SR.get_ArgumentException_ValueTupleIncorrectType, 1: ldarg.0, 2: callvirt System.Object.GetType, 3: call System.SR.Format, 4: ldstr "other", 5: newobj System.ArgumentException..ctor, 6: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument) | System.ArgumentNullException | 0: ldarg.0, 1: call System.ThrowHelper.GetArgumentName, 2: newobj System.ArgumentNullException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRangeException() | System.ArgumentOutOfRangeException | 0: newobj System.ArgumentOutOfRangeException..ctor, 1: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument) | System.ArgumentOutOfRangeException | 0: ldarg.0, 1: call System.ThrowHelper.GetArgumentName, 2: newobj System.ArgumentOutOfRangeException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRangeException_NeedNonNegNum(System.String) | System.ArgumentOutOfRangeException | 0: ldarg.0, 1: call System.SR.get_ArgumentOutOfRange_NeedNonNegNum, 2: newobj System.ArgumentOutOfRangeException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRangeException_PrecisionTooLarge() | System.ArgumentOutOfRangeException | 0: ldstr "precision", 1: call System.SR.get_Argument_PrecisionTooLarge, 2: ldc.i4.s 31, 3: box, 4: call System.SR.Format, 5: newobj System.ArgumentOutOfRangeException..ctor, 6: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRangeException_SymbolDoesNotFit() | System.ArgumentOutOfRangeException | 0: ldstr "symbol", 1: call System.SR.get_Argument_BadFormatSpecifier, 2: newobj System.ArgumentOutOfRangeException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRange_BadHourMinuteSecond() | System.ArgumentOutOfRangeException | 0: ldnull, 1: call System.SR.get_ArgumentOutOfRange_BadHourMinuteSecond, 2: newobj System.ArgumentOutOfRangeException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRange_BadYearMonthDay() | System.ArgumentOutOfRangeException | 0: ldnull, 1: call System.SR.get_ArgumentOutOfRange_BadYearMonthDay, 2: newobj System.ArgumentOutOfRangeException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRange_DayNumber(System.Int32) | System.ArgumentOutOfRangeException | 0: ldstr "dayNumber", 1: ldarg.0, 2: box, 3: call System.SR.get_ArgumentOutOfRange_DayNumber, 4: newobj System.ArgumentOutOfRangeException..ctor, 5: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRange_IndexMustBeLessException() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.1, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRange_IndexMustBeLessOrEqualException() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.0, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRange_Month(System.Int32) | System.ArgumentOutOfRangeException | 0: ldstr "month", 1: ldarg.0, 2: box, 3: call System.SR.get_ArgumentOutOfRange_Month, 4: newobj System.ArgumentOutOfRangeException..ctor, 5: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRange_Range`1(System.String,!0,!0,!0) | System.ArgumentOutOfRangeException | 0: ldarg.0, 1: ldarg.1, 2: box, 3: call System.SR.get_ArgumentOutOfRange_Range, 4: ldarg.2, 5: box, 6: ldarg.3, 7: box, 8: call System.SR.Format, 9: newobj System.ArgumentOutOfRangeException..ctor, 10: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRange_TimeSpanTooLong() | System.ArgumentOutOfRangeException | 0: ldnull, 1: call System.SR.get_Overflow_TimeSpanTooLong, 2: newobj System.ArgumentOutOfRangeException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArgumentOutOfRange_Year() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.5, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArraySegmentCtorValidationFailedExceptions(System.Array,System.Int32,System.Int32) | System.Exception | 0: ldarg.0, 1: ldarg.1, 2: ldarg.2, 3: call System.ThrowHelper.GetArraySegmentCtorValidationFailedException, 4: throw |
|
||||
| System.Void System.ThrowHelper.ThrowArrayTypeMismatchException() | System.ArrayTypeMismatchException | 0: newobj System.ArrayTypeMismatchException..ctor, 1: throw |
|
||||
| System.Void System.ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.4, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowEndOfFileException() | System.Exception | 0: call System.ThrowHelper.CreateEndOfFileException, 1: throw |
|
||||
| System.Void System.ThrowHelper.ThrowFormatException_BadBoolean(System.ReadOnlySpan<System.Char>) | System.FormatException | 0: call System.SR.get_Format_BadBoolean, 1: ldarg.0, 2: newobj System.String..ctor, 3: call System.SR.Format, 4: newobj System.FormatException..ctor, 5: throw |
|
||||
| System.Void System.ThrowHelper.ThrowFormatException_BadFormatSpecifier() | System.FormatException | 0: call System.SR.get_Argument_BadFormatSpecifier, 1: newobj System.FormatException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowFormatException_NeedSingleChar() | System.FormatException | 0: call System.SR.get_Format_NeedSingleChar, 1: newobj System.FormatException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowFormatIndexOutOfRange() | System.FormatException | 0: call System.SR.get_Format_IndexOutOfRange, 1: newobj System.FormatException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowFormatInvalidString() | System.FormatException | 0: call System.SR.get_Format_InvalidString, 1: newobj System.FormatException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.s 31, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowIndexOutOfRangeException() | System.IndexOutOfRangeException | 0: newobj System.IndexOutOfRangeException..ctor, 1: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException() | System.InvalidOperationException | 0: newobj System.InvalidOperationException..ctor, 1: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported() | System.InvalidOperationException | 0: call System.SR.get_InvalidOperation_ConcurrentOperationsNotSupported, 1: newobj System.InvalidOperationException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_EnumCurrent(System.Int32) | System.InvalidOperationException | 0: ldarg.0, 1: call System.ThrowHelper.GetInvalidOperationException_EnumCurrent, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_HandleIsNotInitialized() | System.InvalidOperationException | 0: call System.SR.get_InvalidOperation_HandleIsNotInitialized, 1: newobj System.InvalidOperationException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_HandleIsNotPinned() | System.InvalidOperationException | 0: call System.SR.get_InvalidOperation_HandleIsNotPinned, 1: newobj System.InvalidOperationException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded() | System.InvalidOperationException | 0: call System.SR.get_InvalidOperation_EnumEnded, 1: newobj System.InvalidOperationException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion() | System.InvalidOperationException | 0: call System.SR.get_InvalidOperation_EnumFailedVersion, 1: newobj System.InvalidOperationException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted() | System.InvalidOperationException | 0: call System.SR.get_InvalidOperation_EnumNotStarted, 1: newobj System.InvalidOperationException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen() | System.InvalidOperationException | 0: call System.SR.get_InvalidOperation_EnumOpCantHappen, 1: newobj System.InvalidOperationException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_NoValue() | System.InvalidOperationException | 0: call System.SR.get_InvalidOperation_NoValue, 1: newobj System.InvalidOperationException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidOperationException_InvalidUtf8() | System.InvalidOperationException | 0: call System.SR.get_InvalidOperation_InvalidUtf8, 1: newobj System.InvalidOperationException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(System.Type) | System.ArgumentException | 0: call System.SR.get_Argument_InvalidTypeWithPointersNotSupported, 1: ldarg.0, 2: call System.SR.Format, 3: newobj System.ArgumentException..ctor, 4: throw |
|
||||
| System.Void System.ThrowHelper.ThrowKeyNotFoundException`1(!0) | System.Collections.Generic.KeyNotFoundException | 0: ldarg.0, 1: box, 2: call System.ThrowHelper.GetKeyNotFoundException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.s 31, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowNotSupportedException() | System.NotSupportedException | 0: newobj System.NotSupportedException..ctor, 1: throw |
|
||||
| System.Void System.ThrowHelper.ThrowNotSupportedException_UnreadableStream() | System.NotSupportedException | 0: call System.SR.get_NotSupported_UnreadableStream, 1: newobj System.NotSupportedException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowNotSupportedException_UnseekableStream() | System.NotSupportedException | 0: call System.SR.get_NotSupported_UnseekableStream, 1: newobj System.NotSupportedException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowNotSupportedException_UnwritableStream() | System.NotSupportedException | 0: call System.SR.get_NotSupported_UnwritableStream, 1: newobj System.NotSupportedException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowObjectDisposedException(System.Object) | System.ObjectDisposedException | 0: ldarg.0, 1: brtrue.s 4:, 2: ldnull, 3: br.s 7:, 4: ldarg.0, 5: call System.Object.GetType, 6: callvirt System.Type.get_FullName, 7: newobj System.ObjectDisposedException..ctor, 8: throw |
|
||||
| System.Void System.ThrowHelper.ThrowObjectDisposedException(System.Type) | System.ObjectDisposedException | 0: ldarg.0, 1: brtrue.s 4:, 2: ldnull, 3: br.s 6:, 4: ldarg.0, 5: callvirt System.Type.get_FullName, 6: newobj System.ObjectDisposedException..ctor, 7: throw |
|
||||
| System.Void System.ThrowHelper.ThrowObjectDisposedException_FileClosed() | System.ObjectDisposedException | 0: ldnull, 1: call System.SR.get_ObjectDisposed_FileClosed, 2: newobj System.ObjectDisposedException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowObjectDisposedException_StreamClosed(System.String) | System.ObjectDisposedException | 0: ldarg.0, 1: call System.SR.get_ObjectDisposed_StreamClosed, 2: newobj System.ObjectDisposedException..ctor, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowOutOfMemoryException() | System.OutOfMemoryException | 0: newobj System.OutOfMemoryException..ctor, 1: throw |
|
||||
| System.Void System.ThrowHelper.ThrowOutOfMemoryException_StringTooLong() | System.OutOfMemoryException | 0: call System.SR.get_OutOfMemory_StringTooLong, 1: newobj System.OutOfMemoryException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowOverflowException() | System.OverflowException | 0: newobj System.OverflowException..ctor, 1: throw |
|
||||
| System.Void System.ThrowHelper.ThrowOverflowException_TimeSpanTooLong() | System.OverflowException | 0: call System.SR.get_Overflow_TimeSpanTooLong, 1: newobj System.OverflowException..ctor, 2: throw |
|
||||
| System.Void System.ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_IndexMustBeLess() | System.ArgumentOutOfRangeException | 0: ldc.i4.8, 1: ldc.i4.1, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_IndexMustBeLessOrEqual() | System.ArgumentOutOfRangeException | 0: ldc.i4.8, 1: ldc.i4.0, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowUnexpectedStateForKnownCallback(System.Object) | System.ArgumentOutOfRangeException | 0: ldstr "state", 1: ldarg.0, 2: call System.SR.get_Argument_UnexpectedStateForKnownCallback, 3: newobj System.ArgumentOutOfRangeException..ctor, 4: throw |
|
||||
| System.Void System.ThrowHelper.ThrowValueArgumentOutOfRange_NeedNonNegNumException() | System.ArgumentOutOfRangeException | 0: ldc.i4.7, 1: ldc.i4.s 31, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw |
|
||||
| System.Void System.ThrowHelper.ThrowWrongKeyTypeArgumentException`1(!0,System.Type) | System.ArgumentException | 0: ldarg.0, 1: box, 2: ldarg.1, 3: call System.ThrowHelper.GetWrongKeyTypeArgumentException, 4: throw |
|
||||
| System.Void System.ThrowHelper.ThrowWrongValueTypeArgumentException`1(!0,System.Type) | System.ArgumentException | 0: ldarg.0, 1: box, 2: ldarg.1, 3: call System.ThrowHelper.GetWrongValueTypeArgumentException, 4: throw |
|
||||
@@ -1,39 +0,0 @@
|
||||
import cil
|
||||
import semmle.code.cil.CallableReturns
|
||||
|
||||
predicate relevantMethod(CIL::Method m) {
|
||||
m.getName() = "GetEncoder" and not m.getDeclaringType().getName() = "OSEncoding"
|
||||
or
|
||||
m.getName() = "get_Item"
|
||||
or
|
||||
m.getDeclaringType().getName() = "ThrowHelper" and
|
||||
not m.getParameter(_).getType().getName() = "ExceptionResource"
|
||||
or
|
||||
m.getLocation().(CIL::Assembly).getName().matches("DataFlow%")
|
||||
}
|
||||
|
||||
// Check that the assembly hasn't been marked as a stub.
|
||||
query predicate stubs(string str) {
|
||||
exists(CIL::Assembly asm | CIL::assemblyIsStub(asm) | str = asm.toString())
|
||||
}
|
||||
|
||||
query predicate alwaysNull(string s, string d) {
|
||||
exists(CIL::Method m |
|
||||
alwaysNullMethod(m) and
|
||||
s = m.toStringWithTypes() and
|
||||
relevantMethod(m) and
|
||||
d = m.getImplementation().getDisassembly()
|
||||
)
|
||||
}
|
||||
|
||||
query predicate alwaysNonNull(string s) {
|
||||
exists(CIL::Method m | alwaysNotNullMethod(m) and s = m.toStringWithTypes() and relevantMethod(m))
|
||||
}
|
||||
|
||||
query predicate alwaysThrows(string s, string ex, string d) {
|
||||
exists(CIL::Method m, CIL::Type t | alwaysThrowsException(m, t) and relevantMethod(m) |
|
||||
s = m.toStringWithTypes() and
|
||||
ex = t.toStringWithTypes() and
|
||||
d = m.getImplementation().getDisassembly()
|
||||
)
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
| dataflow.cs:55:9:55:18 | call to method DeadCode |
|
||||
| dataflow.cs:63:9:63:18 | call to method DeadCode |
|
||||
@@ -1,6 +0,0 @@
|
||||
import csharp
|
||||
|
||||
query predicate deadCode(MethodCall c) {
|
||||
c.getTarget().getName() = "DeadCode" and
|
||||
not exists(ControlFlow::Node node | node.getAstNode() = c)
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
// Generate DataFlow.dll: `csc /o /target:library DataFlow.cs_ /out:DataFlow.dll`
|
||||
|
||||
using System;
|
||||
|
||||
namespace Dataflow
|
||||
{
|
||||
public class NullMethods
|
||||
{
|
||||
public object ReturnsNull() => null;
|
||||
|
||||
public object ReturnsNull2()
|
||||
{
|
||||
var x = ReturnsNull();
|
||||
return x;
|
||||
}
|
||||
|
||||
// Does not necessarily return null because of virtual method call.
|
||||
public object NotReturnsNull() => VirtualReturnsNull();
|
||||
|
||||
public object ReturnsNullIndirect() => ReturnsNull();
|
||||
|
||||
public virtual object VirtualReturnsNull() => null;
|
||||
|
||||
public object NullProperty { get => null; }
|
||||
|
||||
public virtual object VirtualNullProperty { get => null; }
|
||||
}
|
||||
|
||||
public class NonNullMethods
|
||||
{
|
||||
public object ReturnsNonNull() => new object();
|
||||
|
||||
public object ReturnsNonNull2()
|
||||
{
|
||||
var x = ReturnsNonNull();
|
||||
return x;
|
||||
}
|
||||
|
||||
public object ReturnsNonNullIndirect() => ReturnsNonNull();
|
||||
|
||||
public object NonNullProperty { get => 1; }
|
||||
|
||||
public string NonNullProperty2 { get => "not null"; }
|
||||
|
||||
public virtual object VirtualNonNull { get => "not null"; }
|
||||
|
||||
public bool cond = false;
|
||||
|
||||
public string MaybeNull()
|
||||
{
|
||||
if (cond)
|
||||
return null;
|
||||
else
|
||||
return "not null";
|
||||
}
|
||||
|
||||
public string MaybeNull2()
|
||||
{
|
||||
return cond ? null : "not null";
|
||||
}
|
||||
|
||||
public virtual object VirtualNonNullProperty { get => "non null"; }
|
||||
}
|
||||
|
||||
public class ThrowingMethods
|
||||
{
|
||||
public static object AlwaysThrows() => throw new InvalidOperationException();
|
||||
|
||||
public object AlwaysThrowsIndirect() => AlwaysThrows();
|
||||
|
||||
public virtual object VirtualThrows() => throw new Exception();
|
||||
|
||||
public object ThrowProperty { get => throw new Exception(); }
|
||||
public virtual object VirtualThrowProperty { get => throw new Exception(); }
|
||||
|
||||
}
|
||||
|
||||
public class DataFlow
|
||||
{
|
||||
public object Taint1(object x) => x;
|
||||
|
||||
public object Taint2(object x) => Taint5(x);
|
||||
|
||||
public string Taint3(string s)
|
||||
{
|
||||
var x = s;
|
||||
Console.WriteLine(s);
|
||||
return x;
|
||||
}
|
||||
|
||||
public object Taint5(object x) => Taint6(x);
|
||||
|
||||
private object Taint6(object x) => x;
|
||||
}
|
||||
|
||||
public class TaintFlow
|
||||
{
|
||||
public string Taint1(string a, string b) => a + b;
|
||||
|
||||
public int Taint2(int a, int b) => a + b;
|
||||
|
||||
public int Taint3(int a) => -a;
|
||||
|
||||
public string TaintIndirect(string a, string b) => Taint1(a, b);
|
||||
}
|
||||
|
||||
public class Properties
|
||||
{
|
||||
public int TrivialProperty1 { get; set; }
|
||||
|
||||
int field;
|
||||
|
||||
public int TrivialProperty2
|
||||
{
|
||||
get => field;
|
||||
set { field = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public class ThisAssemblyIsNotAStub
|
||||
{
|
||||
public void F()
|
||||
{
|
||||
// Ensure that the assembly isn't tagged as a stub
|
||||
// Need to bump the average instruction count.
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
Console.WriteLine("This is not a stub assembly");
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,146 +0,0 @@
|
||||
edges
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint2 : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint3 : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint5 : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint6 : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of TaintIndirect : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 2 of Taint1 : String | DataFlow.dll:0:0:0:0 | ldarg.2 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 2 of TaintIndirect : String | DataFlow.dll:0:0:0:0 | ldarg.2 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint5 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint6 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | call : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | call : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | call : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | call : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.2 : String | DataFlow.dll:0:0:0:0 | Parameter 2 of Taint1 : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.2 : String | DataFlow.dll:0:0:0:0 | call : String | provenance | |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.2 : String | DataFlow.dll:0:0:0:0 | call : String | provenance | |
|
||||
| dataflow.cs:16:18:16:26 | "tainted" : String | dataflow.cs:16:18:16:37 | call to method ToString | provenance | |
|
||||
| dataflow.cs:18:27:18:27 | 2 : Int32 | dataflow.cs:18:18:18:31 | call to method Max | provenance | |
|
||||
| dataflow.cs:18:30:18:30 | 3 : Int32 | dataflow.cs:18:18:18:31 | call to method Max | provenance | |
|
||||
| dataflow.cs:19:29:19:31 | 0.5 : Double | dataflow.cs:19:18:19:32 | call to method Round | provenance | |
|
||||
| dataflow.cs:20:45:20:53 | "tainted" : String | dataflow.cs:20:18:20:54 | call to method GetFullPath | provenance | |
|
||||
| dataflow.cs:27:44:27:46 | 1 : Double | dataflow.cs:27:18:27:52 | call to method IEEERemainder | provenance | |
|
||||
| dataflow.cs:27:49:27:51 | 2 : Double | dataflow.cs:27:18:27:52 | call to method IEEERemainder | provenance | |
|
||||
| dataflow.cs:38:34:38:37 | "d1" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | provenance | |
|
||||
| dataflow.cs:38:34:38:37 | "d1" : String | dataflow.cs:38:18:38:38 | call to method Taint1 | provenance | |
|
||||
| dataflow.cs:39:34:39:37 | "d2" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint2 : String | provenance | |
|
||||
| dataflow.cs:39:34:39:37 | "d2" : String | dataflow.cs:39:18:39:38 | call to method Taint2 | provenance | |
|
||||
| dataflow.cs:40:34:40:37 | "d3" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint3 : String | provenance | |
|
||||
| dataflow.cs:40:34:40:37 | "d3" : String | dataflow.cs:40:18:40:38 | call to method Taint3 | provenance | |
|
||||
| dataflow.cs:44:28:44:32 | "t1a" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | provenance | |
|
||||
| dataflow.cs:44:28:44:32 | "t1a" : String | dataflow.cs:44:18:44:40 | call to method Taint1 | provenance | |
|
||||
| dataflow.cs:44:35:44:39 | "t1b" : String | DataFlow.dll:0:0:0:0 | Parameter 2 of Taint1 : String | provenance | |
|
||||
| dataflow.cs:44:35:44:39 | "t1b" : String | dataflow.cs:44:18:44:40 | call to method Taint1 | provenance | |
|
||||
| dataflow.cs:47:35:47:38 | "t6" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of TaintIndirect : String | provenance | |
|
||||
| dataflow.cs:47:35:47:38 | "t6" : String | dataflow.cs:47:18:47:45 | call to method TaintIndirect | provenance | |
|
||||
| dataflow.cs:47:41:47:44 | "t6" : String | DataFlow.dll:0:0:0:0 | Parameter 2 of TaintIndirect : String | provenance | |
|
||||
| dataflow.cs:47:41:47:44 | "t6" : String | dataflow.cs:47:18:47:45 | call to method TaintIndirect | provenance | |
|
||||
| dataflow.cs:72:21:72:34 | call to method NullFunction : null | dataflow.cs:72:21:72:52 | ... ?? ... | provenance | |
|
||||
| dataflow.cs:72:39:72:52 | call to method IndirectNull : null | dataflow.cs:72:21:72:52 | ... ?? ... | provenance | |
|
||||
| dataflow.cs:87:31:87:44 | call to method NullFunction : null | dataflow.cs:87:24:87:51 | ... ? ... : ... | provenance | |
|
||||
| dataflow.cs:100:30:100:33 | null : null | dataflow.cs:72:39:72:52 | call to method IndirectNull : null | provenance | |
|
||||
| dataflow.cs:100:30:100:33 | null : null | dataflow.cs:106:20:106:33 | call to method IndirectNull | provenance | |
|
||||
| dataflow.cs:100:30:100:33 | null : null | dataflow.cs:106:20:106:33 | call to method IndirectNull : null | provenance | |
|
||||
| dataflow.cs:106:16:106:16 | access to local variable x : null | dataflow.cs:108:16:108:16 | access to local variable x : null | provenance | |
|
||||
| dataflow.cs:106:20:106:33 | call to method IndirectNull : null | dataflow.cs:106:16:106:16 | access to local variable x : null | provenance | |
|
||||
| dataflow.cs:107:19:107:19 | access to local variable x : null | dataflow.cs:108:16:108:16 | access to local variable x : null | provenance | |
|
||||
| dataflow.cs:107:23:107:26 | null : null | dataflow.cs:107:19:107:19 | access to local variable x : null | provenance | |
|
||||
| dataflow.cs:108:16:108:16 | access to local variable x : null | dataflow.cs:72:21:72:34 | call to method NullFunction : null | provenance | |
|
||||
| dataflow.cs:108:16:108:16 | access to local variable x : null | dataflow.cs:87:31:87:44 | call to method NullFunction : null | provenance | |
|
||||
nodes
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | semmle.label | Parameter 1 of Taint1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | semmle.label | Parameter 1 of Taint1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint2 : String | semmle.label | Parameter 1 of Taint2 : String |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint3 : String | semmle.label | Parameter 1 of Taint3 : String |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint5 : String | semmle.label | Parameter 1 of Taint5 : String |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of Taint6 : String | semmle.label | Parameter 1 of Taint6 : String |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 1 of TaintIndirect : String | semmle.label | Parameter 1 of TaintIndirect : String |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 2 of Taint1 : String | semmle.label | Parameter 2 of Taint1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | Parameter 2 of TaintIndirect : String | semmle.label | Parameter 2 of TaintIndirect : String |
|
||||
| DataFlow.dll:0:0:0:0 | call : String | semmle.label | call : String |
|
||||
| DataFlow.dll:0:0:0:0 | call : String | semmle.label | call : String |
|
||||
| DataFlow.dll:0:0:0:0 | call : String | semmle.label | call : String |
|
||||
| DataFlow.dll:0:0:0:0 | call : String | semmle.label | call : String |
|
||||
| DataFlow.dll:0:0:0:0 | call : String | semmle.label | call : String |
|
||||
| DataFlow.dll:0:0:0:0 | call : String | semmle.label | call : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | semmle.label | ldarg.1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | semmle.label | ldarg.1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | semmle.label | ldarg.1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | semmle.label | ldarg.1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | semmle.label | ldarg.1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | semmle.label | ldarg.1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | semmle.label | ldarg.1 : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.2 : String | semmle.label | ldarg.2 : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.2 : String | semmle.label | ldarg.2 : String |
|
||||
| dataflow.cs:16:18:16:26 | "tainted" : String | semmle.label | "tainted" : String |
|
||||
| dataflow.cs:16:18:16:37 | call to method ToString | semmle.label | call to method ToString |
|
||||
| dataflow.cs:18:18:18:31 | call to method Max | semmle.label | call to method Max |
|
||||
| dataflow.cs:18:27:18:27 | 2 : Int32 | semmle.label | 2 : Int32 |
|
||||
| dataflow.cs:18:30:18:30 | 3 : Int32 | semmle.label | 3 : Int32 |
|
||||
| dataflow.cs:19:18:19:32 | call to method Round | semmle.label | call to method Round |
|
||||
| dataflow.cs:19:29:19:31 | 0.5 : Double | semmle.label | 0.5 : Double |
|
||||
| dataflow.cs:20:18:20:54 | call to method GetFullPath | semmle.label | call to method GetFullPath |
|
||||
| dataflow.cs:20:45:20:53 | "tainted" : String | semmle.label | "tainted" : String |
|
||||
| dataflow.cs:27:18:27:52 | call to method IEEERemainder | semmle.label | call to method IEEERemainder |
|
||||
| dataflow.cs:27:44:27:46 | 1 : Double | semmle.label | 1 : Double |
|
||||
| dataflow.cs:27:49:27:51 | 2 : Double | semmle.label | 2 : Double |
|
||||
| dataflow.cs:38:18:38:38 | call to method Taint1 | semmle.label | call to method Taint1 |
|
||||
| dataflow.cs:38:34:38:37 | "d1" : String | semmle.label | "d1" : String |
|
||||
| dataflow.cs:39:18:39:38 | call to method Taint2 | semmle.label | call to method Taint2 |
|
||||
| dataflow.cs:39:34:39:37 | "d2" : String | semmle.label | "d2" : String |
|
||||
| dataflow.cs:40:18:40:38 | call to method Taint3 | semmle.label | call to method Taint3 |
|
||||
| dataflow.cs:40:34:40:37 | "d3" : String | semmle.label | "d3" : String |
|
||||
| dataflow.cs:44:18:44:40 | call to method Taint1 | semmle.label | call to method Taint1 |
|
||||
| dataflow.cs:44:28:44:32 | "t1a" : String | semmle.label | "t1a" : String |
|
||||
| dataflow.cs:44:35:44:39 | "t1b" : String | semmle.label | "t1b" : String |
|
||||
| dataflow.cs:47:18:47:45 | call to method TaintIndirect | semmle.label | call to method TaintIndirect |
|
||||
| dataflow.cs:47:35:47:38 | "t6" : String | semmle.label | "t6" : String |
|
||||
| dataflow.cs:47:41:47:44 | "t6" : String | semmle.label | "t6" : String |
|
||||
| dataflow.cs:72:21:72:34 | call to method NullFunction : null | semmle.label | call to method NullFunction : null |
|
||||
| dataflow.cs:72:21:72:52 | ... ?? ... | semmle.label | ... ?? ... |
|
||||
| dataflow.cs:72:39:72:52 | call to method IndirectNull : null | semmle.label | call to method IndirectNull : null |
|
||||
| dataflow.cs:87:24:87:51 | ... ? ... : ... | semmle.label | ... ? ... : ... |
|
||||
| dataflow.cs:87:31:87:44 | call to method NullFunction : null | semmle.label | call to method NullFunction : null |
|
||||
| dataflow.cs:100:30:100:33 | null : null | semmle.label | null : null |
|
||||
| dataflow.cs:106:16:106:16 | access to local variable x : null | semmle.label | access to local variable x : null |
|
||||
| dataflow.cs:106:20:106:33 | call to method IndirectNull | semmle.label | call to method IndirectNull |
|
||||
| dataflow.cs:106:20:106:33 | call to method IndirectNull : null | semmle.label | call to method IndirectNull : null |
|
||||
| dataflow.cs:107:19:107:19 | access to local variable x : null | semmle.label | access to local variable x : null |
|
||||
| dataflow.cs:107:23:107:26 | null : null | semmle.label | null : null |
|
||||
| dataflow.cs:108:16:108:16 | access to local variable x : null | semmle.label | access to local variable x : null |
|
||||
subpaths
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | DataFlow.dll:0:0:0:0 | call : String | DataFlow.dll:0:0:0:0 | call : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint5 : String | DataFlow.dll:0:0:0:0 | call : String | DataFlow.dll:0:0:0:0 | call : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint6 : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | DataFlow.dll:0:0:0:0 | call : String |
|
||||
| DataFlow.dll:0:0:0:0 | ldarg.2 : String | DataFlow.dll:0:0:0:0 | Parameter 2 of Taint1 : String | DataFlow.dll:0:0:0:0 | call : String | DataFlow.dll:0:0:0:0 | call : String |
|
||||
| dataflow.cs:38:34:38:37 | "d1" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | dataflow.cs:38:18:38:38 | call to method Taint1 |
|
||||
| dataflow.cs:39:34:39:37 | "d2" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint2 : String | DataFlow.dll:0:0:0:0 | call : String | dataflow.cs:39:18:39:38 | call to method Taint2 |
|
||||
| dataflow.cs:40:34:40:37 | "d3" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint3 : String | DataFlow.dll:0:0:0:0 | ldarg.1 : String | dataflow.cs:40:18:40:38 | call to method Taint3 |
|
||||
| dataflow.cs:44:28:44:32 | "t1a" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of Taint1 : String | DataFlow.dll:0:0:0:0 | call : String | dataflow.cs:44:18:44:40 | call to method Taint1 |
|
||||
| dataflow.cs:44:35:44:39 | "t1b" : String | DataFlow.dll:0:0:0:0 | Parameter 2 of Taint1 : String | DataFlow.dll:0:0:0:0 | call : String | dataflow.cs:44:18:44:40 | call to method Taint1 |
|
||||
| dataflow.cs:47:35:47:38 | "t6" : String | DataFlow.dll:0:0:0:0 | Parameter 1 of TaintIndirect : String | DataFlow.dll:0:0:0:0 | call : String | dataflow.cs:47:18:47:45 | call to method TaintIndirect |
|
||||
| dataflow.cs:47:41:47:44 | "t6" : String | DataFlow.dll:0:0:0:0 | Parameter 2 of TaintIndirect : String | DataFlow.dll:0:0:0:0 | call : String | dataflow.cs:47:18:47:45 | call to method TaintIndirect |
|
||||
#select
|
||||
| dataflow.cs:16:18:16:26 | "tainted" : String | dataflow.cs:16:18:16:37 | call to method ToString | dataflow.cs:16:18:16:37 | call to method ToString | $@ | dataflow.cs:16:18:16:37 | call to method ToString | call to method ToString |
|
||||
| dataflow.cs:18:27:18:27 | 2 : Int32 | dataflow.cs:18:18:18:31 | call to method Max | dataflow.cs:18:18:18:31 | call to method Max | $@ | dataflow.cs:18:18:18:31 | call to method Max | call to method Max |
|
||||
| dataflow.cs:18:30:18:30 | 3 : Int32 | dataflow.cs:18:18:18:31 | call to method Max | dataflow.cs:18:18:18:31 | call to method Max | $@ | dataflow.cs:18:18:18:31 | call to method Max | call to method Max |
|
||||
| dataflow.cs:19:29:19:31 | 0.5 : Double | dataflow.cs:19:18:19:32 | call to method Round | dataflow.cs:19:18:19:32 | call to method Round | $@ | dataflow.cs:19:18:19:32 | call to method Round | call to method Round |
|
||||
| dataflow.cs:20:45:20:53 | "tainted" : String | dataflow.cs:20:18:20:54 | call to method GetFullPath | dataflow.cs:20:18:20:54 | call to method GetFullPath | $@ | dataflow.cs:20:18:20:54 | call to method GetFullPath | call to method GetFullPath |
|
||||
| dataflow.cs:27:44:27:46 | 1 : Double | dataflow.cs:27:18:27:52 | call to method IEEERemainder | dataflow.cs:27:18:27:52 | call to method IEEERemainder | $@ | dataflow.cs:27:18:27:52 | call to method IEEERemainder | call to method IEEERemainder |
|
||||
| dataflow.cs:27:49:27:51 | 2 : Double | dataflow.cs:27:18:27:52 | call to method IEEERemainder | dataflow.cs:27:18:27:52 | call to method IEEERemainder | $@ | dataflow.cs:27:18:27:52 | call to method IEEERemainder | call to method IEEERemainder |
|
||||
| dataflow.cs:38:34:38:37 | "d1" : String | dataflow.cs:38:18:38:38 | call to method Taint1 | dataflow.cs:38:18:38:38 | call to method Taint1 | $@ | dataflow.cs:38:18:38:38 | call to method Taint1 | call to method Taint1 |
|
||||
| dataflow.cs:39:34:39:37 | "d2" : String | dataflow.cs:39:18:39:38 | call to method Taint2 | dataflow.cs:39:18:39:38 | call to method Taint2 | $@ | dataflow.cs:39:18:39:38 | call to method Taint2 | call to method Taint2 |
|
||||
| dataflow.cs:40:34:40:37 | "d3" : String | dataflow.cs:40:18:40:38 | call to method Taint3 | dataflow.cs:40:18:40:38 | call to method Taint3 | $@ | dataflow.cs:40:18:40:38 | call to method Taint3 | call to method Taint3 |
|
||||
| dataflow.cs:44:28:44:32 | "t1a" : String | dataflow.cs:44:18:44:40 | call to method Taint1 | dataflow.cs:44:18:44:40 | call to method Taint1 | $@ | dataflow.cs:44:18:44:40 | call to method Taint1 | call to method Taint1 |
|
||||
| dataflow.cs:44:35:44:39 | "t1b" : String | dataflow.cs:44:18:44:40 | call to method Taint1 | dataflow.cs:44:18:44:40 | call to method Taint1 | $@ | dataflow.cs:44:18:44:40 | call to method Taint1 | call to method Taint1 |
|
||||
| dataflow.cs:47:35:47:38 | "t6" : String | dataflow.cs:47:18:47:45 | call to method TaintIndirect | dataflow.cs:47:18:47:45 | call to method TaintIndirect | $@ | dataflow.cs:47:18:47:45 | call to method TaintIndirect | call to method TaintIndirect |
|
||||
| dataflow.cs:47:41:47:44 | "t6" : String | dataflow.cs:47:18:47:45 | call to method TaintIndirect | dataflow.cs:47:18:47:45 | call to method TaintIndirect | $@ | dataflow.cs:47:18:47:45 | call to method TaintIndirect | call to method TaintIndirect |
|
||||
| dataflow.cs:100:30:100:33 | null : null | dataflow.cs:72:21:72:52 | ... ?? ... | dataflow.cs:72:21:72:52 | ... ?? ... | $@ | dataflow.cs:72:21:72:52 | ... ?? ... | ... ?? ... |
|
||||
| dataflow.cs:100:30:100:33 | null : null | dataflow.cs:87:24:87:51 | ... ? ... : ... | dataflow.cs:87:24:87:51 | ... ? ... : ... | $@ | dataflow.cs:87:24:87:51 | ... ? ... : ... | ... ? ... : ... |
|
||||
| dataflow.cs:100:30:100:33 | null : null | dataflow.cs:106:20:106:33 | call to method IndirectNull | dataflow.cs:106:20:106:33 | call to method IndirectNull | $@ | dataflow.cs:106:20:106:33 | call to method IndirectNull | call to method IndirectNull |
|
||||
| dataflow.cs:107:23:107:26 | null : null | dataflow.cs:72:21:72:52 | ... ?? ... | dataflow.cs:72:21:72:52 | ... ?? ... | $@ | dataflow.cs:72:21:72:52 | ... ?? ... | ... ?? ... |
|
||||
| dataflow.cs:107:23:107:26 | null : null | dataflow.cs:87:24:87:51 | ... ? ... : ... | dataflow.cs:87:24:87:51 | ... ? ... : ... | $@ | dataflow.cs:87:24:87:51 | ... ? ... : ... | ... ? ... : ... |
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* @kind path-problem
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import Flow::PathGraph
|
||||
|
||||
private predicate relevantPathNode(Flow::PathNode n) {
|
||||
exists(File f | f = n.getNode().getLocation().getFile() |
|
||||
f.fromSource()
|
||||
or
|
||||
f.getBaseName() = "DataFlow.dll"
|
||||
)
|
||||
}
|
||||
|
||||
query predicate edges(Flow::PathNode a, Flow::PathNode b, string key, string val) {
|
||||
Flow::PathGraph::edges(a, b, key, val) and
|
||||
relevantPathNode(a) and
|
||||
relevantPathNode(b)
|
||||
}
|
||||
|
||||
query predicate nodes(Flow::PathNode n, string key, string val) {
|
||||
Flow::PathGraph::nodes(n, key, val) and
|
||||
relevantPathNode(n)
|
||||
}
|
||||
|
||||
query predicate subpaths(
|
||||
Flow::PathNode arg, Flow::PathNode par, Flow::PathNode ret, Flow::PathNode out
|
||||
) {
|
||||
Flow::PathGraph::subpaths(arg, par, ret, out) and
|
||||
relevantPathNode(arg) and
|
||||
relevantPathNode(par) and
|
||||
relevantPathNode(ret) and
|
||||
relevantPathNode(out)
|
||||
}
|
||||
|
||||
module FlowConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) { source.asExpr() instanceof Literal }
|
||||
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
exists(LocalVariable decl | sink.asExpr() = decl.getInitializer())
|
||||
}
|
||||
}
|
||||
|
||||
module Flow = DataFlow::Global<FlowConfig>;
|
||||
|
||||
from Flow::PathNode source, Flow::PathNode sink
|
||||
where Flow::flowPath(source, sink)
|
||||
select source, sink, sink, "$@", sink, sink.toString()
|
||||
@@ -1,24 +0,0 @@
|
||||
// Generate DataFlowUnoptimized.dll: `csc /target:library DataFlowUnoptimized.cs_ /out:DataFlowUnoptimized.dll`
|
||||
|
||||
using System;
|
||||
|
||||
namespace DataflowUnoptimized
|
||||
{
|
||||
public class MaybeNullMethods
|
||||
{
|
||||
public bool cond = false;
|
||||
|
||||
public string MaybeNull()
|
||||
{
|
||||
if (cond)
|
||||
return null;
|
||||
else
|
||||
return "not null";
|
||||
}
|
||||
|
||||
public string MaybeNull2()
|
||||
{
|
||||
return cond ? null : "not null";
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,42 +0,0 @@
|
||||
alwaysNull
|
||||
| dataflow.cs:68:21:68:35 | default(...) |
|
||||
| dataflow.cs:72:21:72:34 | call to method NullFunction |
|
||||
| dataflow.cs:72:21:72:52 | ... ?? ... |
|
||||
| dataflow.cs:72:39:72:52 | call to method IndirectNull |
|
||||
| dataflow.cs:76:21:76:45 | call to method ReturnsNull |
|
||||
| dataflow.cs:77:21:77:46 | call to method ReturnsNull2 |
|
||||
| dataflow.cs:78:21:78:44 | access to property NullProperty |
|
||||
| dataflow.cs:87:31:87:44 | call to method NullFunction |
|
||||
alwaysNotNull
|
||||
| dataflow.cs:69:13:69:20 | access to local variable nonNull1 |
|
||||
| dataflow.cs:69:13:69:35 | Int32 nonNull1 = ... |
|
||||
| dataflow.cs:69:24:69:35 | default(...) |
|
||||
| dataflow.cs:69:32:69:34 | access to type Int32 |
|
||||
| dataflow.cs:70:27:70:30 | this access |
|
||||
| dataflow.cs:70:27:70:40 | call to method GetType |
|
||||
| dataflow.cs:71:30:71:33 | true |
|
||||
| dataflow.cs:71:30:71:44 | call to method ToString |
|
||||
| dataflow.cs:72:21:72:34 | this access |
|
||||
| dataflow.cs:72:39:72:52 | this access |
|
||||
| dataflow.cs:75:27:75:52 | object creation of type NullMethods |
|
||||
| dataflow.cs:76:21:76:31 | access to local variable nullMethods |
|
||||
| dataflow.cs:77:21:77:31 | access to local variable nullMethods |
|
||||
| dataflow.cs:78:21:78:31 | access to local variable nullMethods |
|
||||
| dataflow.cs:81:23:81:51 | object creation of type NonNullMethods |
|
||||
| dataflow.cs:82:24:82:30 | access to local variable nonNull |
|
||||
| dataflow.cs:82:24:82:47 | call to method ReturnsNonNull |
|
||||
| dataflow.cs:83:24:83:30 | access to local variable nonNull |
|
||||
| dataflow.cs:83:24:83:55 | call to method ReturnsNonNullIndirect |
|
||||
| dataflow.cs:84:24:84:30 | access to local variable nonNull |
|
||||
| dataflow.cs:87:24:87:27 | access to field cond |
|
||||
| dataflow.cs:87:24:87:27 | this access |
|
||||
| dataflow.cs:87:31:87:44 | this access |
|
||||
| dataflow.cs:87:48:87:51 | this access |
|
||||
| dataflow.cs:88:24:88:34 | access to local variable nullMethods |
|
||||
| dataflow.cs:89:24:89:34 | access to local variable nullMethods |
|
||||
| dataflow.cs:90:26:90:32 | access to local variable nonNull |
|
||||
| dataflow.cs:93:25:93:31 | access to local variable nonNull |
|
||||
| dataflow.cs:94:26:94:32 | access to local variable nonNull |
|
||||
| dataflow.cs:95:32:95:73 | object creation of type MaybeNullMethods |
|
||||
| dataflow.cs:96:21:96:36 | access to local variable maybeNullMethods |
|
||||
| dataflow.cs:97:22:97:37 | access to local variable maybeNullMethods |
|
||||
@@ -1,10 +0,0 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.Nullness
|
||||
|
||||
query predicate alwaysNull(AlwaysNullExpr expr) {
|
||||
expr.getEnclosingCallable().getName() = "Nullness"
|
||||
}
|
||||
|
||||
query predicate alwaysNotNull(NonNullExpr expr) {
|
||||
expr.getEnclosingCallable().getName() = "Nullness"
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
| dataflow.cs:9:18:9:22 | "123" | dataflow.cs:9:18:9:37 | call to method CompareTo |
|
||||
| dataflow.cs:9:34:9:36 | "b" | dataflow.cs:9:18:9:37 | call to method CompareTo |
|
||||
| dataflow.cs:16:18:16:26 | "tainted" | dataflow.cs:16:18:16:37 | call to method ToString |
|
||||
| dataflow.cs:18:27:18:27 | 2 | dataflow.cs:18:18:18:31 | call to method Max |
|
||||
| dataflow.cs:18:30:18:30 | 3 | dataflow.cs:18:18:18:31 | call to method Max |
|
||||
| dataflow.cs:19:29:19:31 | 0.5 | dataflow.cs:19:18:19:32 | call to method Round |
|
||||
| dataflow.cs:20:45:20:53 | "tainted" | dataflow.cs:20:18:20:54 | call to method GetFullPath |
|
||||
| dataflow.cs:24:37:24:37 | 1 | dataflow.cs:24:18:24:56 | call to method DivRem |
|
||||
| dataflow.cs:24:40:24:40 | 2 | dataflow.cs:24:18:24:56 | call to method DivRem |
|
||||
| dataflow.cs:27:44:27:46 | 1 | dataflow.cs:27:18:27:52 | call to method IEEERemainder |
|
||||
| dataflow.cs:27:49:27:51 | 2 | dataflow.cs:27:18:27:52 | call to method IEEERemainder |
|
||||
| dataflow.cs:30:60:30:60 | 1 | dataflow.cs:30:18:30:80 | call to method DivRem |
|
||||
| dataflow.cs:30:63:30:63 | 2 | dataflow.cs:30:18:30:80 | call to method DivRem |
|
||||
| dataflow.cs:38:34:38:37 | "d1" | dataflow.cs:38:18:38:38 | call to method Taint1 |
|
||||
| dataflow.cs:39:34:39:37 | "d2" | dataflow.cs:39:18:39:38 | call to method Taint2 |
|
||||
| dataflow.cs:40:34:40:37 | "d3" | dataflow.cs:40:18:40:38 | call to method Taint3 |
|
||||
| dataflow.cs:44:28:44:32 | "t1a" | dataflow.cs:44:18:44:40 | call to method Taint1 |
|
||||
| dataflow.cs:44:35:44:39 | "t1b" | dataflow.cs:44:18:44:40 | call to method Taint1 |
|
||||
| dataflow.cs:45:28:45:28 | 2 | dataflow.cs:45:18:45:32 | call to method Taint2 |
|
||||
| dataflow.cs:45:31:45:31 | 3 | dataflow.cs:45:18:45:32 | call to method Taint2 |
|
||||
| dataflow.cs:46:28:46:28 | 1 | dataflow.cs:46:18:46:29 | call to method Taint3 |
|
||||
| dataflow.cs:47:35:47:38 | "t6" | dataflow.cs:47:18:47:45 | call to method TaintIndirect |
|
||||
| dataflow.cs:47:41:47:44 | "t6" | dataflow.cs:47:18:47:45 | call to method TaintIndirect |
|
||||
| dataflow.cs:100:30:100:33 | null | dataflow.cs:72:21:72:52 | ... ?? ... |
|
||||
| dataflow.cs:100:30:100:33 | null | dataflow.cs:87:24:87:51 | ... ? ... : ... |
|
||||
| dataflow.cs:100:30:100:33 | null | dataflow.cs:106:20:106:33 | call to method IndirectNull |
|
||||
| dataflow.cs:107:23:107:26 | null | dataflow.cs:72:21:72:52 | ... ?? ... |
|
||||
| dataflow.cs:107:23:107:26 | null | dataflow.cs:87:24:87:51 | ... ? ... : ... |
|
||||
@@ -1,21 +0,0 @@
|
||||
import csharp
|
||||
// Test that all the copies of the taint tracking library can be imported
|
||||
// simultaneously without errors.
|
||||
import semmle.code.csharp.dataflow.TaintTracking2
|
||||
import semmle.code.csharp.dataflow.TaintTracking3
|
||||
import semmle.code.csharp.dataflow.TaintTracking4
|
||||
import semmle.code.csharp.dataflow.TaintTracking5
|
||||
|
||||
module FlowConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) { source.asExpr() instanceof Literal }
|
||||
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
exists(LocalVariable decl | sink.asExpr() = decl.getInitializer())
|
||||
}
|
||||
}
|
||||
|
||||
module Flow = TaintTracking::Global<FlowConfig>;
|
||||
|
||||
from DataFlow::Node source, DataFlow::Node sink
|
||||
where Flow::flow(source, sink)
|
||||
select source, sink
|
||||
@@ -1,11 +0,0 @@
|
||||
| Dataflow.Properties.TrivialProperty1 |
|
||||
| Dataflow.Properties.TrivialProperty2 |
|
||||
| System.Collections.DictionaryEntry.Key |
|
||||
| System.Collections.DictionaryEntry.Value |
|
||||
| System.Reflection.AssemblyName.CodeBase |
|
||||
| System.Reflection.AssemblyName.CultureInfo |
|
||||
| System.Reflection.AssemblyName.HashAlgorithm |
|
||||
| System.Reflection.AssemblyName.Name |
|
||||
| System.Reflection.AssemblyName.RawFlags |
|
||||
| System.Reflection.AssemblyName.Version |
|
||||
| System.Reflection.AssemblyName.VersionCompatibility |
|
||||
@@ -1,15 +0,0 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.commons.QualifiedName
|
||||
|
||||
from TrivialProperty prop, string namespace, string type, string name
|
||||
where
|
||||
prop.getDeclaringType().hasFullyQualifiedName(namespace, type) and
|
||||
(
|
||||
namespace = "System.Reflection" and type = "AssemblyName"
|
||||
or
|
||||
namespace = "System.Collections" and type = "DictionaryEntry"
|
||||
or
|
||||
namespace = "Dataflow" and type = "Properties"
|
||||
) and
|
||||
prop.hasFullyQualifiedName(namespace, type, name)
|
||||
select getQualifiedName(namespace, type, name)
|
||||
@@ -1,110 +0,0 @@
|
||||
using System;
|
||||
|
||||
class Test
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Indirect call to method
|
||||
var c1 = "abc".Contains("a"); // Calls string.IndexOf()
|
||||
var c2 = "123".CompareTo("b"); // Calls string.Compare()
|
||||
var c3 = Tuple.Create("c", "d", "e"); // Calls Tuple constructor
|
||||
}
|
||||
|
||||
void DataFlowThroughFramework()
|
||||
{
|
||||
// Dataflow through call
|
||||
var f1 = "tainted".ToString();
|
||||
var f2 = Math.Abs(12);
|
||||
var f3 = Math.Max(2, 3);
|
||||
var f4 = Math.Round(0.5);
|
||||
var f5 = System.IO.Path.GetFullPath("tainted");
|
||||
|
||||
// Tainted dataflow (there is no untainted dataflow path)
|
||||
int remainder;
|
||||
var t1 = System.Math.DivRem(1, 2, out remainder);
|
||||
|
||||
// Tainted indirect call to method (there is no untainted dataflow path)
|
||||
var t2 = System.Math.IEEERemainder(1.0, 2.0);
|
||||
|
||||
// Miscellaneous examples
|
||||
var m1 = System.Math.DivRem(Math.Abs(-1), Math.Max(1, 2), out remainder);
|
||||
var m2 = "tainted".ToString().Contains("t");
|
||||
}
|
||||
|
||||
void DataFlowThroughAssembly()
|
||||
{
|
||||
// Dataflow through test assembly
|
||||
var dataflow = new Dataflow.DataFlow();
|
||||
var d1 = dataflow.Taint1("d1");
|
||||
var d2 = dataflow.Taint2("d2");
|
||||
var d3 = dataflow.Taint3("d3");
|
||||
|
||||
// Taint tracking
|
||||
var tt = new Dataflow.TaintFlow();
|
||||
var t1 = tt.Taint1("t1a", "t1b");
|
||||
var t2 = tt.Taint2(2, 3);
|
||||
var t3 = tt.Taint3(1);
|
||||
var t4 = tt.TaintIndirect("t6", "t6");
|
||||
}
|
||||
|
||||
void DeadCode() { }
|
||||
|
||||
void CilAlwaysThrows()
|
||||
{
|
||||
System.Reflection.Assembly.LoadFrom("", null, System.Configuration.Assemblies.AssemblyHashAlgorithm.SHA1); // Throws NotSupportedException
|
||||
DeadCode();
|
||||
}
|
||||
|
||||
void Throw() => throw new InvalidCastException();
|
||||
|
||||
void CsAlwaysThrows()
|
||||
{
|
||||
Throw();
|
||||
DeadCode();
|
||||
}
|
||||
|
||||
void Nullness()
|
||||
{
|
||||
var @null = default(object);
|
||||
var nonNull1 = default(int);
|
||||
var nullFromCil = this.GetType().DeclaringMethod;
|
||||
var nonNullFromCil = true.ToString();
|
||||
var null2 = NullFunction() ?? IndirectNull();
|
||||
|
||||
// Null from dataflow assembly
|
||||
var nullMethods = new Dataflow.NullMethods();
|
||||
var null3 = nullMethods.ReturnsNull(); // Null
|
||||
var null4 = nullMethods.ReturnsNull2();
|
||||
var null5 = nullMethods.NullProperty;
|
||||
|
||||
// NotNull
|
||||
var nonNull = new Dataflow.NonNullMethods();
|
||||
var nonNull2 = nonNull.ReturnsNonNull();
|
||||
var nonNull3 = nonNull.ReturnsNonNullIndirect();
|
||||
var nonNull4 = nonNull.NonNullProperty;
|
||||
|
||||
// The following are not always null:
|
||||
var notNull1 = cond ? NullFunction() : this;
|
||||
var notNull2 = nullMethods.VirtualReturnsNull();
|
||||
var notNull3 = nullMethods.VirtualNullProperty;
|
||||
var notNonNull = nonNull.VirtualNonNull;
|
||||
|
||||
// The following are maybe null
|
||||
var maybeNull = nonNull.MaybeNull();
|
||||
var maybeNull2 = nonNull.MaybeNull2();
|
||||
var maybeNullMethods = new DataflowUnoptimized.MaybeNullMethods();
|
||||
maybeNull = maybeNullMethods.MaybeNull();
|
||||
maybeNull2 = maybeNullMethods.MaybeNull2();
|
||||
}
|
||||
|
||||
object IndirectNull() => null;
|
||||
|
||||
bool cond;
|
||||
|
||||
object NullFunction()
|
||||
{
|
||||
object x = IndirectNull();
|
||||
if (cond) x = null;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
semmle-extractor-options: --cil
|
||||
@@ -9,8 +9,11 @@ predicate osSpecific(string qualifier, string name) {
|
||||
)
|
||||
}
|
||||
|
||||
from Enum e, string qualifier, string name
|
||||
where
|
||||
e.hasFullyQualifiedName(qualifier, name) and
|
||||
not osSpecific(qualifier, name)
|
||||
select getQualifiedName(qualifier, name), e.getUnderlyingType().toStringWithTypes()
|
||||
deprecated query predicate enums(string qualifiedName, string type) {
|
||||
exists(Enum e, string qualifier, string name |
|
||||
e.hasFullyQualifiedName(qualifier, name) and
|
||||
not osSpecific(qualifier, name) and
|
||||
qualifiedName = getQualifiedName(qualifier, name) and
|
||||
type = e.getUnderlyingType().toStringWithTypes()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,16 +3,20 @@ import semmle.code.cil.Type
|
||||
import semmle.code.csharp.commons.QualifiedName
|
||||
|
||||
bindingset[kind]
|
||||
private string getKind(int kind) { if kind = 1 then result = "modreq" else result = "modopt" }
|
||||
deprecated private string getKind(int kind) {
|
||||
if kind = 1 then result = "modreq" else result = "modopt"
|
||||
}
|
||||
|
||||
bindingset[t, e]
|
||||
private string getAnnotatedType(Type t, Element e) {
|
||||
deprecated private string getAnnotatedType(Type t, Element e) {
|
||||
cil_type_annotation(e, 32) and result = t.toString() + "&"
|
||||
or
|
||||
not cil_type_annotation(e, 32) and result = t.toString()
|
||||
}
|
||||
|
||||
query predicate fnptr(string fnptr, int paramCount, string returnType, int callingConvention) {
|
||||
deprecated query predicate fnptr(
|
||||
string fnptr, int paramCount, string returnType, int callingConvention
|
||||
) {
|
||||
exists(FunctionPointerType fn | fnptr = fn.toString() |
|
||||
paramCount = fn.getNumberOfParameters() and
|
||||
returnType = getAnnotatedType(fn.getReturnType(), fn) and
|
||||
@@ -20,13 +24,13 @@ query predicate fnptr(string fnptr, int paramCount, string returnType, int calli
|
||||
)
|
||||
}
|
||||
|
||||
query predicate params(string fnptr, int i, string param, string t) {
|
||||
deprecated query predicate params(string fnptr, int i, string param, string t) {
|
||||
exists(FunctionPointerType fn, Parameter p | fnptr = fn.toString() and param = p.toString() |
|
||||
fn.getParameter(i) = p and t = getAnnotatedType(p.getType(), p)
|
||||
)
|
||||
}
|
||||
|
||||
query predicate modifiers(string fnptr, string modifier, string sKind) {
|
||||
deprecated query predicate modifiers(string fnptr, string modifier, string sKind) {
|
||||
exists(Type modType, int kind, FunctionPointerType fn, string qualifier, string name |
|
||||
fnptr = fn.toString()
|
||||
|
|
||||
|
||||
@@ -2,14 +2,16 @@ import semmle.code.cil.Type
|
||||
import semmle.code.csharp.commons.QualifiedName
|
||||
|
||||
bindingset[kind]
|
||||
private string getKind(int kind) { if kind = 1 then result = "modreq" else result = "modopt" }
|
||||
deprecated private string getKind(int kind) {
|
||||
if kind = 1 then result = "modreq" else result = "modopt"
|
||||
}
|
||||
|
||||
from string receiver, string modifier, int kind
|
||||
where
|
||||
exists(Type modType, CustomModifierReceiver cmr, string qualifier, string name |
|
||||
deprecated query predicate customModifiers(string receiver, string modifier, string kind) {
|
||||
exists(Type modType, CustomModifierReceiver cmr, string qualifier, string name, int k |
|
||||
receiver = cmr.toString() and
|
||||
cil_custom_modifiers(cmr, modType, kind) and
|
||||
cil_custom_modifiers(cmr, modType, k) and
|
||||
modType.hasFullyQualifiedName(qualifier, name) and
|
||||
modifier = getQualifiedName(qualifier, name)
|
||||
modifier = getQualifiedName(qualifier, name) and
|
||||
kind = getKind(k)
|
||||
)
|
||||
select receiver, modifier, getKind(kind)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import semmle.code.cil.Method
|
||||
import semmle.code.csharp.Location
|
||||
|
||||
private string getType(Setter s) { if s.isInitOnly() then result = "init" else result = "set" }
|
||||
deprecated private string getType(Setter s) {
|
||||
if s.isInitOnly() then result = "init" else result = "set"
|
||||
}
|
||||
|
||||
from Setter s
|
||||
where s.getLocation().(Assembly).getName() = "cil-init-prop"
|
||||
select s, getType(s)
|
||||
deprecated query predicate setters(Setter s, string type) {
|
||||
s.getLocation().(Assembly).getName() = "cil-init-prop" and
|
||||
type = getType(s)
|
||||
}
|
||||
|
||||
@@ -2,13 +2,16 @@ import cil
|
||||
|
||||
// Used only because native PDBs are only supported on Windows.
|
||||
// They are included as tests but disabled here.
|
||||
predicate filterMethod(CIL::Method m) {
|
||||
deprecated predicate filterMethod(CIL::Method m) {
|
||||
m.getDeclaringType().getNamespace().getName() = "EmbeddedPdb" or
|
||||
m.getDeclaringType().getNamespace().getName() = "PortablePdb"
|
||||
}
|
||||
|
||||
from CIL::Instruction instruction, CIL::Location location
|
||||
where
|
||||
location = instruction.getLocation() and
|
||||
filterMethod(instruction.getImplementation().getMethod())
|
||||
select location.toString(), instruction.toStringExtra()
|
||||
deprecated query predicate instructionLocations(string loc, string extra) {
|
||||
exists(CIL::Instruction instruction, CIL::Location location |
|
||||
location = instruction.getLocation() and
|
||||
filterMethod(instruction.getImplementation().getMethod()) and
|
||||
loc = location.toString() and
|
||||
extra = instruction.toStringExtra()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,15 +2,18 @@ import cil
|
||||
|
||||
// Used only because native PDBs are only supported on Windows.
|
||||
// They are included as tests but disabled here.
|
||||
predicate filterMethod(CIL::Method m) {
|
||||
deprecated predicate filterMethod(CIL::Method m) {
|
||||
m.getDeclaringType().getNamespace().getName() = "EmbeddedPdb" or
|
||||
m.getDeclaringType().getNamespace().getName() = "PortablePdb"
|
||||
}
|
||||
|
||||
from CIL::Method method, CIL::Location location, boolean primaryLocation
|
||||
where
|
||||
location = method.getALocation() and
|
||||
exists(CIL::Location l | l = method.getALocation() | l.getFile().isPdbSourceFile()) and
|
||||
(if location = method.getLocation() then primaryLocation = true else primaryLocation = false) and
|
||||
filterMethod(method)
|
||||
select method.toStringWithTypes(), location.toString(), primaryLocation
|
||||
deprecated query predicate methodLocations(string m, string loc, boolean primaryLocation) {
|
||||
exists(CIL::Method method, CIL::Location location |
|
||||
location = method.getALocation() and
|
||||
exists(CIL::Location l | l = method.getALocation() | l.getFile().isPdbSourceFile()) and
|
||||
(if location = method.getLocation() then primaryLocation = true else primaryLocation = false) and
|
||||
filterMethod(method) and
|
||||
m = method.toStringWithTypes() and
|
||||
loc = location.toString()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import cil::CIL
|
||||
|
||||
from Assembly asm
|
||||
where assemblyIsStub(asm)
|
||||
select asm
|
||||
deprecated query predicate stubs(Assembly asm) { assemblyIsStub(asm) }
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import cil::CIL
|
||||
|
||||
from UnboundGenericMethod f, ConstructedMethod fc
|
||||
where
|
||||
deprecated query predicate constructedMethods(
|
||||
UnboundGenericMethod f, ConstructedMethod fc, Type typeArgument
|
||||
) {
|
||||
fc.getUnboundMethod() = f and
|
||||
f.hasFullyQualifiedName("Methods", "Class1", "F")
|
||||
select f, fc, fc.getTypeArgument(0)
|
||||
f.hasFullyQualifiedName("Methods", "Class1", "F") and
|
||||
typeArgument = fc.getTypeArgument(0)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import cil
|
||||
import semmle.code.csharp.commons.QualifiedName
|
||||
import semmle.code.cil.Type
|
||||
|
||||
private string elementType(Element e, string toString) {
|
||||
deprecated private string elementType(Element e, string toString) {
|
||||
exists(string namespace, string type, string name |
|
||||
toString = getQualifiedName(namespace, type, name)
|
||||
|
|
||||
@@ -48,7 +48,7 @@ private string elementType(Element e, string toString) {
|
||||
toString = e.toString()
|
||||
}
|
||||
|
||||
private predicate exclude(string s) {
|
||||
deprecated private predicate exclude(string s) {
|
||||
s in [
|
||||
"Parameter 0 of Interop.libobjc.NSOperatingSystemVersion_objc_msgSend_stret",
|
||||
"Parameter 1 of Interop.procfs.TryParseStatusFile",
|
||||
@@ -77,17 +77,18 @@ private predicate exclude(string s) {
|
||||
]
|
||||
}
|
||||
|
||||
from Element e, int i, string toString, string type
|
||||
where
|
||||
cil_type_annotation(e, i) and
|
||||
type = elementType(e, toString) and
|
||||
not exclude(toString) and
|
||||
(
|
||||
not e instanceof Parameter
|
||||
or
|
||||
not exists(Type t |
|
||||
t = e.(Parameter).getDeclaringElement().(Method).getDeclaringType() and
|
||||
t.hasFullyQualifiedName("System", "Environment")
|
||||
) // There are OS specific methods in this class
|
||||
deprecated query predicate typeAnnotation(string toString, string type, int i) {
|
||||
exists(Element e |
|
||||
cil_type_annotation(e, i) and
|
||||
type = elementType(e, toString) and
|
||||
not exclude(toString) and
|
||||
(
|
||||
not e instanceof Parameter
|
||||
or
|
||||
not exists(Type t |
|
||||
t = e.(Parameter).getDeclaringElement().(Method).getDeclaringType() and
|
||||
t.hasFullyQualifiedName("System", "Environment")
|
||||
) // There are OS specific methods in this class
|
||||
)
|
||||
)
|
||||
select toString, type, i
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace DisposalTests
|
||||
{
|
||||
public class MyType : IDisposable
|
||||
{
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class Class1 : IDisposable
|
||||
{
|
||||
public void DisposesParameter(IDisposable p1, IDisposable p2)
|
||||
{
|
||||
p1.Dispose();
|
||||
}
|
||||
|
||||
public void CapturesDisposable(MyType p1, MyType p2)
|
||||
{
|
||||
field1 = p1;
|
||||
field2 = p2;
|
||||
}
|
||||
|
||||
public void DisposesSelf()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
MyType field1, field2;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
field1.Dispose();
|
||||
}
|
||||
|
||||
public static void Dispose(IDisposable d)
|
||||
{
|
||||
d.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,11 @@ class Disposal : IDisposable
|
||||
Close();
|
||||
}
|
||||
|
||||
public Disposal(IDisposable p1, object p2, System.IO.TextWriter fs)
|
||||
public Disposal(IDisposable p1, object p2, System.IO.TextWriter fs, IDisposable p3)
|
||||
{
|
||||
field1 = p1;
|
||||
if(p2 is IDisposable d)
|
||||
if (p2 is IDisposable d)
|
||||
d.Dispose();
|
||||
DisposalTests.Class1.Dispose(fs);
|
||||
fs.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
| DisposalTests.Class1.field1 |
|
||||
@@ -1,10 +0,0 @@
|
||||
import cil
|
||||
import semmle.code.csharp.commons.Disposal
|
||||
import semmle.code.csharp.commons.QualifiedName
|
||||
|
||||
from CIL::Field field, string qualifier, string name
|
||||
where
|
||||
mayBeDisposed(field) and
|
||||
field.getDeclaringType().hasFullyQualifiedName("DisposalTests", "Class1") and
|
||||
field.hasFullyQualifiedName(qualifier, name)
|
||||
select getQualifiedName(qualifier, name)
|
||||
@@ -1,6 +1,3 @@
|
||||
| CapturesDisposable(MyType, MyType) | 0 |
|
||||
| Dispose(IDisposable) | 0 |
|
||||
| DisposesParameter(IDisposable, IDisposable) | 0 |
|
||||
| System.Void DisposalTests.Class1.CapturesDisposable(DisposalTests.MyType,DisposalTests.MyType) | 0 |
|
||||
| System.Void DisposalTests.Class1.Dispose(System.IDisposable) | 0 |
|
||||
| System.Void DisposalTests.Class1.DisposesParameter(System.IDisposable,System.IDisposable) | 0 |
|
||||
| Disposal(IDisposable, object, TextWriter, IDisposable) | 0 |
|
||||
| Disposal(IDisposable, object, TextWriter, IDisposable) | 1 |
|
||||
| Disposal(IDisposable, object, TextWriter, IDisposable) | 2 |
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user