Merge pull request #1459 from hvitved/csharp/remove-deprecated

C#: Remove deprecated predicates
This commit is contained in:
Calum Grant 2019-06-19 17:56:20 +01:00 коммит произвёл GitHub
Родитель 07eb0ec5b2 5443f74660
Коммит 3c9c0e943b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 0 добавлений и 246 удалений

Просмотреть файл

@ -62,45 +62,6 @@ class BasicBlock extends TBasicBlockStart {
*/ */
BasicBlock getAFalseSuccessor() { result.getFirstNode() = getLastNode().getAFalseSuccessor() } BasicBlock getAFalseSuccessor() { result.getFirstNode() = getLastNode().getAFalseSuccessor() }
/**
* Gets an immediate `null` successor, if any.
*
* An immediate `null` successor is a successor that is reached when
* the expression that ends this basic block evaluates to `null`.
*
* Example:
*
* ```
* x?.M();
* return;
* ```
*
* The node on line 2 is an immediate `null` successor of the node
* `x` on line 1.
*/
deprecated BasicBlock getANullSuccessor() {
result.getFirstNode() = getLastNode().getANullSuccessor()
}
/**
* Gets an immediate non-`null` successor, if any.
*
* An immediate non-`null` successor is a successor that is reached when
* the expression that ends this basic block evaluates to a non-`null` value.
*
* Example:
*
* ```
* x?.M();
* ```
*
* The node `x?.M()`, representing the call to `M`, is a non-`null` successor
* of the node `x`.
*/
deprecated BasicBlock getANonNullSuccessor() {
result.getFirstNode() = getLastNode().getANonNullSuccessor()
}
/** Gets the control flow node at a specific (zero-indexed) position in this basic block. */ /** Gets the control flow node at a specific (zero-indexed) position in this basic block. */
ControlFlow::Node getNode(int pos) { bbIndex(getFirstNode(), result, pos) } ControlFlow::Node getNode(int pos) { bbIndex(getFirstNode(), result, pos) }
@ -511,81 +472,4 @@ class ConditionBlock extends BasicBlock {
exists(BasicBlock succ | this.immediatelyControls(succ, s) | succ.dominates(controlled)) exists(BasicBlock succ | this.immediatelyControls(succ, s) | succ.dominates(controlled))
} }
/**
* Holds if basic block `controlled` is controlled by this basic block with
* nullness check `isNull`. That is, `controlled` can only be reached from
* the callable entry point by going via the `null` edge (`isNull = true`)
* or non-`null` edge (`isNull = false`) out of this basic block.
*/
deprecated predicate controlsNullness(BasicBlock controlled, boolean isNull) {
this.controls(controlled, any(NullnessSuccessor s | s.getValue() = isNull))
}
/**
* Holds if basic block `controlled` is controlled by this basic block with
* Boolean value `testIsTrue`. That is, `controlled` can only be reached from
* the callable entry point by going via the true edge (`testIsTrue = true`)
* or false edge (`testIsTrue = false`) out of this basic block.
*
* Moreover, `cond` is a sub expression of the expression ending this basic
* block that must have evaluated to `condIsTrue`. For example, in
*
* ```
* if (x & !y)
* f(x, y);
* ```
*
* `f(x, y)` is controlled by `x & !y` evaluating to `true`, but also by sub
* conditions `x` and `y` evaluating to `true` and `false`, respectively.
*/
// Note that this is only needed when using non-short-circuit logic. When using
// short-circuit logic, the control flow graph will have appropriate true/false
// edges for the sub conditions:
//
// Short-circuit logic CFG -- `if (x && y) A B`:
// x && y --> x --true--> y --true--> A
// | |
// | false
// | |
// | V
// \--false--> B
//
// Non-short-circuit logic CFG -- `if (x & y) A B`:
// x --> y --> x & y --true--> A
// \--false--> B
//
// In the former case, `x` and `y` control `A`, in the latter case
// only `x & y` controls `A` if we do not take sub conditions into account.
deprecated predicate controlsSubCond(
BasicBlock controlled, boolean testIsTrue, Expr cond, boolean condIsTrue
) {
impliesSub(getLastNode().getElement(), cond, testIsTrue, condIsTrue) and
controls(controlled, any(BooleanSuccessor s | s.getValue() = testIsTrue))
}
}
/**
* Holds if `e2` is a sub expression of (Boolean) expression `e1`, and
* if `e1` has value `b1` then `e2` must have value `b2`.
*/
deprecated private predicate impliesSub(Expr e1, Expr e2, boolean b1, boolean b2) {
if e1 instanceof LogicalNotExpr
then impliesSub(e1.(LogicalNotExpr).getOperand(), e2, b1.booleanNot(), b2)
else
if e1 instanceof BitwiseAndExpr or e1 instanceof LogicalAndExpr
then
impliesSub(e1.(BinaryOperation).getAnOperand(), e2, b1, b2) and
b1 = true
else
if e1 instanceof BitwiseOrExpr or e1 instanceof LogicalOrExpr
then (
impliesSub(e1.(BinaryOperation).getAnOperand(), e2, b1, b2) and
b1 = false
) else (
e1.getType() instanceof BoolType and
e1 = e2 and
b1 = b2 and
(b1 = true or b1 = false)
)
} }

Просмотреть файл

@ -233,45 +233,6 @@ module ControlFlow {
result = getASuccessorByType(any(BooleanSuccessor t | t.getValue() = false)) result = getASuccessorByType(any(BooleanSuccessor t | t.getValue() = false))
} }
/**
* Gets an immediate `null` successor, if any.
*
* An immediate `null` successor is a successor that is reached when
* this expression evaluates to `null`.
*
* Example:
*
* ```
* x?.M();
* return;
* ```
*
* The node on line 2 is an immediate `null` successor of the node
* `x` on line 1.
*/
deprecated Node getANullSuccessor() {
result = getASuccessorByType(any(NullnessSuccessor t | t.isNull()))
}
/**
* Gets an immediate non-`null` successor, if any.
*
* An immediate non-`null` successor is a successor that is reached when
* this expressions evaluates to a non-`null` value.
*
* Example:
*
* ```
* x?.M();
* ```
*
* The node `x?.M()`, representing the call to `M`, is a non-`null` successor
* of the node `x`.
*/
deprecated Node getANonNullSuccessor() {
result = getASuccessorByType(any(NullnessSuccessor t | not t.isNull()))
}
/** Holds if this node has more than one predecessor. */ /** Holds if this node has more than one predecessor. */
predicate isJoin() { strictcount(this.getAPredecessor()) > 1 } predicate isJoin() { strictcount(this.getAPredecessor()) > 1 }
@ -2038,85 +1999,3 @@ module ControlFlow {
} }
private import Internal private import Internal
} }
// The code below is all for backwards-compatibility; should be deleted eventually
deprecated class ControlFlowNode = ControlFlow::Node;
deprecated class CallableEntryNode = ControlFlow::Nodes::EntryNode;
deprecated class CallableExitNode = ControlFlow::Nodes::ExitNode;
/**
* DEPRECATED: Use `ElementNode` instead.
*
* A node for a control flow element.
*/
deprecated class NormalControlFlowNode extends ControlFlow::Nodes::ElementNode {
NormalControlFlowNode() {
forall(ControlFlow::Nodes::FinallySplit s | s = this.getASplit() |
s.getType() instanceof ControlFlow::SuccessorTypes::NormalSuccessor
)
}
}
/**
* DEPRECATED: Use `ElementNode` instead.
*
* A split node for a control flow element that belongs to a `finally` block.
*/
deprecated class FinallySplitControlFlowNode extends ControlFlow::Nodes::ElementNode {
FinallySplitControlFlowNode() {
exists(ControlFlow::Internal::FinallySplitting::FinallySplitType type |
type = this.getASplit().(ControlFlow::Nodes::FinallySplit).getType()
|
not type instanceof ControlFlow::SuccessorTypes::NormalSuccessor
)
}
/** Gets the try statement that this `finally` node belongs to. */
TryStmt getTryStmt() {
this.getElement() = ControlFlow::Internal::FinallySplitting::getAFinallyDescendant(result)
}
}
/** DEPRECATED: Use `ControlFlow::SuccessorType` instead. */
deprecated class ControlFlowEdgeType = ControlFlow::SuccessorType;
/** DEPRECATED: Use `ControlFlow::NormalSuccessor` instead. */
deprecated class ControlFlowEdgeSuccessor = ControlFlow::SuccessorTypes::NormalSuccessor;
/** DEPRECATED: Use `ControlFlow::ConditionalSuccessor` instead. */
deprecated class ControlFlowEdgeConditional = ControlFlow::SuccessorTypes::ConditionalSuccessor;
/** DEPRECATED: Use `ControlFlow::BooleanSuccessor` instead. */
deprecated class ControlFlowEdgeBoolean = ControlFlow::SuccessorTypes::BooleanSuccessor;
/** DEPRECATED: Use `ControlFlow::NullnessSuccessor` instead. */
deprecated class ControlFlowEdgeNullness = ControlFlow::SuccessorTypes::NullnessSuccessor;
/** DEPRECATED: Use `ControlFlow::MatchingSuccessor` instead. */
deprecated class ControlFlowEdgeMatching = ControlFlow::SuccessorTypes::MatchingSuccessor;
/** DEPRECATED: Use `ControlFlow::EmptinessSuccessor` instead. */
deprecated class ControlFlowEdgeEmptiness = ControlFlow::SuccessorTypes::EmptinessSuccessor;
/** DEPRECATED: Use `ControlFlow::ReturnSuccessor` instead. */
deprecated class ControlFlowEdgeReturn = ControlFlow::SuccessorTypes::ReturnSuccessor;
/** DEPRECATED: Use `ControlFlow::BreakSuccessor` instead. */
deprecated class ControlFlowEdgeBreak = ControlFlow::SuccessorTypes::BreakSuccessor;
/** DEPRECATED: Use `ControlFlow::ContinueSuccessor` instead. */
deprecated class ControlFlowEdgeContinue = ControlFlow::SuccessorTypes::ContinueSuccessor;
/** DEPRECATED: Use `ControlFlow::GotoLabelSuccessor` instead. */
deprecated class ControlFlowEdgeGotoLabel = ControlFlow::SuccessorTypes::GotoLabelSuccessor;
/** DEPRECATED: Use `ControlFlow::GotoCaseSuccessor` instead. */
deprecated class ControlFlowEdgeGotoCase = ControlFlow::SuccessorTypes::GotoCaseSuccessor;
/** DEPRECATED: Use `ControlFlow::GotoDefaultSuccessor` instead. */
deprecated class ControlFlowEdgeGotoDefault = ControlFlow::SuccessorTypes::GotoDefaultSuccessor;
/** DEPRECATED: Use `ControlFlow::ExceptionSuccessor` instead. */
deprecated class ControlFlowEdgeException = ControlFlow::SuccessorTypes::ExceptionSuccessor;

Просмотреть файл

@ -125,9 +125,6 @@ module AbstractValues {
/** Gets the case. */ /** Gets the case. */
Case getCase() { this = TMatchValue(result, _) } Case getCase() { this = TMatchValue(result, _) }
/** Gets the case statement. */
deprecated CaseStmt getCaseStmt() { result = this.getCase() }
/** Holds if this value represents a match. */ /** Holds if this value represents a match. */
predicate isMatch() { this = TMatchValue(_, true) } predicate isMatch() { this = TMatchValue(_, true) }

Просмотреть файл

@ -411,12 +411,6 @@ module Ssa {
/** Gets the qualifier of this source variable, if any. */ /** Gets the qualifier of this source variable, if any. */
SourceVariable getQualifier() { none() } SourceVariable getQualifier() { none() }
/**
* Gets an SSA definition that has this variable as its underlying
* source variable.
*/
deprecated Definition getAnDefinition() { result.getSourceVariable() = this }
/** /**
* Gets an SSA definition that has this variable as its underlying * Gets an SSA definition that has this variable as its underlying
* source variable. * source variable.