Skip to content

Commit c64223a

Browse files
authored
Merge pull request #21748 from hvitved/shared/remove-deprecated
Shared: Remove deprecated code
2 parents cb21044 + 61f1ef8 commit c64223a

11 files changed

Lines changed: 21 additions & 908 deletions

File tree

csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -311,69 +311,6 @@ module Ssa {
311311
result.getControlFlowNode() = cfn
312312
}
313313

314-
/**
315-
* Gets a last read of the source variable underlying this SSA definition.
316-
* That is, a read that can reach the end of the enclosing callable, or
317-
* another SSA definition for the source variable, without passing through
318-
* any other read. Example:
319-
*
320-
* ```csharp
321-
* int Field;
322-
*
323-
* void SetField(int i) {
324-
* this.Field = i;
325-
* Use(this.Field);
326-
* if (i > 0)
327-
* this.Field = i - 1;
328-
* else if (i < 0)
329-
* SetField(1);
330-
* Use(this.Field);
331-
* Use(this.Field);
332-
* }
333-
* ```
334-
*
335-
* - The reads of `i` on lines 7 and 8 are the last reads for the implicit
336-
* parameter definition on line 3.
337-
* - The read of `this.Field` on line 5 is a last read of the definition on
338-
* line 4.
339-
* - The read of `this.Field` on line 11 is a last read of the phi node
340-
* between lines 9 and 10.
341-
*/
342-
deprecated final AssignableRead getALastRead() { result = this.getALastReadAtNode(_) }
343-
344-
/**
345-
* Gets a last read of the source variable underlying this SSA definition at
346-
* control flow node `cfn`. That is, a read that can reach the end of the
347-
* enclosing callable, or another SSA definition for the source variable,
348-
* without passing through any other read. Example:
349-
*
350-
* ```csharp
351-
* int Field;
352-
*
353-
* void SetField(int i) {
354-
* this.Field = i;
355-
* Use(this.Field);
356-
* if (i > 0)
357-
* this.Field = i - 1;
358-
* else if (i < 0)
359-
* SetField(1);
360-
* Use(this.Field);
361-
* Use(this.Field);
362-
* }
363-
* ```
364-
*
365-
* - The reads of `i` on lines 7 and 8 are the last reads for the implicit
366-
* parameter definition on line 3.
367-
* - The read of `this.Field` on line 5 is a last read of the definition on
368-
* line 4.
369-
* - The read of `this.Field` on line 11 is a last read of the phi node
370-
* between lines 9 and 10.
371-
*/
372-
deprecated final AssignableRead getALastReadAtNode(ControlFlowNode cfn) {
373-
SsaImpl::lastReadSameVar(this, cfn) and
374-
result.getControlFlowNode() = cfn
375-
}
376-
377314
/**
378315
* Gets an SSA definition whose value can flow to this one in one step. This
379316
* includes inputs to phi nodes and the prior definitions of uncertain writes.

csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -713,61 +713,6 @@ private predicate variableReadPseudo(BasicBlock bb, int i, Ssa::SourceVariable v
713713
refReadBeforeWrite(bb, i, v)
714714
}
715715

716-
pragma[noinline]
717-
deprecated private predicate adjacentDefRead(
718-
Definition def, BasicBlock bb1, int i1, BasicBlock bb2, int i2, SsaInput::SourceVariable v
719-
) {
720-
Impl::adjacentDefRead(def, bb1, i1, bb2, i2) and
721-
v = def.getSourceVariable()
722-
}
723-
724-
deprecated private predicate adjacentDefReachesRead(
725-
Definition def, SsaInput::SourceVariable v, BasicBlock bb1, int i1, BasicBlock bb2, int i2
726-
) {
727-
adjacentDefRead(def, bb1, i1, bb2, i2, v) and
728-
(
729-
def.definesAt(v, bb1, i1)
730-
or
731-
SsaInput::variableRead(bb1, i1, v, true)
732-
)
733-
or
734-
exists(BasicBlock bb3, int i3 |
735-
adjacentDefReachesRead(def, v, bb1, i1, bb3, i3) and
736-
SsaInput::variableRead(bb3, i3, _, false) and
737-
Impl::adjacentDefRead(def, bb3, i3, bb2, i2)
738-
)
739-
}
740-
741-
deprecated private predicate adjacentDefReachesUncertainRead(
742-
Definition def, BasicBlock bb1, int i1, BasicBlock bb2, int i2
743-
) {
744-
exists(SsaInput::SourceVariable v |
745-
adjacentDefReachesRead(def, v, bb1, i1, bb2, i2) and
746-
SsaInput::variableRead(bb2, i2, v, false)
747-
)
748-
}
749-
750-
/** Same as `lastRefRedef`, but skips uncertain reads. */
751-
pragma[nomagic]
752-
deprecated private predicate lastRefSkipUncertainReads(Definition def, BasicBlock bb, int i) {
753-
Impl::lastRef(def, bb, i) and
754-
not SsaInput::variableRead(bb, i, def.getSourceVariable(), false)
755-
or
756-
exists(BasicBlock bb0, int i0 |
757-
Impl::lastRef(def, bb0, i0) and
758-
adjacentDefReachesUncertainRead(def, bb, i, bb0, i0)
759-
)
760-
}
761-
762-
pragma[nomagic]
763-
deprecated predicate lastReadSameVar(Definition def, ControlFlowNode cfn) {
764-
exists(BasicBlock bb, int i |
765-
lastRefSkipUncertainReads(def, bb, i) and
766-
variableReadActual(bb, i, _) and
767-
cfn = bb.getNode(i)
768-
)
769-
}
770-
771716
cached
772717
private module Cached {
773718
cached

ruby/ql/lib/codeql/ruby/dataflow/SSA.qll

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -78,34 +78,6 @@ module Ssa {
7878
*/
7979
final VariableReadAccessCfgNode getAFirstRead() { SsaImpl::firstRead(this, result) }
8080

81-
/**
82-
* Gets a last control-flow node that reads the value of this SSA definition.
83-
* That is, a read that can reach the end of the enclosing CFG scope, or another
84-
* SSA definition for the source variable, without passing through any other read.
85-
*
86-
* Example:
87-
*
88-
* ```rb
89-
* def m b # defines b_0
90-
* i = 0 # defines i_0
91-
* puts i
92-
* puts i + 1 # last read of i_0
93-
* if b # last read of b_0
94-
* i = 1 # defines i_1
95-
* puts i
96-
* puts i + 1 # last read of i_1
97-
* else
98-
* i = 2 # defines i_2
99-
* puts i
100-
* puts i + 1 # last read of i_2
101-
* end
102-
* # defines i_3 = phi(i_1, i_2)
103-
* puts i # last read of i3
104-
* end
105-
* ```
106-
*/
107-
deprecated final VariableReadAccessCfgNode getALastRead() { SsaImpl::lastRead(this, result) }
108-
10981
/**
11082
* Holds if `read1` and `read2` are adjacent reads of this SSA definition.
11183
* That is, `read2` can be reached from `read1` without passing through

ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -212,63 +212,6 @@ private predicate hasVariableReadWithCapturedWrite(
212212
variableReadActualInOuterScope(bb, i, v, scope)
213213
}
214214

215-
pragma[noinline]
216-
deprecated private predicate adjacentDefReadExt(
217-
Definition def, BasicBlock bb1, int i1, BasicBlock bb2, int i2, SsaInput::SourceVariable v
218-
) {
219-
Impl::adjacentDefReadExt(def, _, bb1, i1, bb2, i2) and
220-
v = def.getSourceVariable()
221-
}
222-
223-
deprecated private predicate adjacentDefReachesReadExt(
224-
Definition def, BasicBlock bb1, int i1, BasicBlock bb2, int i2
225-
) {
226-
exists(SsaInput::SourceVariable v | adjacentDefReadExt(def, bb1, i1, bb2, i2, v) |
227-
def.definesAt(v, bb1, i1)
228-
or
229-
SsaInput::variableRead(bb1, i1, v, true)
230-
)
231-
or
232-
exists(BasicBlock bb3, int i3 |
233-
adjacentDefReachesReadExt(def, bb1, i1, bb3, i3) and
234-
SsaInput::variableRead(bb3, i3, _, false) and
235-
Impl::adjacentDefReadExt(def, _, bb3, i3, bb2, i2)
236-
)
237-
}
238-
239-
deprecated private predicate adjacentDefReachesUncertainReadExt(
240-
Definition def, BasicBlock bb1, int i1, BasicBlock bb2, int i2
241-
) {
242-
adjacentDefReachesReadExt(def, bb1, i1, bb2, i2) and
243-
SsaInput::variableRead(bb2, i2, _, false)
244-
}
245-
246-
/** Same as `lastRefRedef`, but skips uncertain reads. */
247-
pragma[nomagic]
248-
deprecated private predicate lastRefSkipUncertainReadsExt(Definition def, BasicBlock bb, int i) {
249-
Impl::lastRef(def, bb, i) and
250-
not SsaInput::variableRead(bb, i, def.getSourceVariable(), false)
251-
or
252-
exists(BasicBlock bb0, int i0 |
253-
Impl::lastRef(def, bb0, i0) and
254-
adjacentDefReachesUncertainReadExt(def, bb, i, bb0, i0)
255-
)
256-
}
257-
258-
/**
259-
* Holds if the read of `def` at `read` may be a last read. That is, `read`
260-
* can either reach another definition of the underlying source variable or
261-
* the end of the CFG scope, without passing through another non-pseudo read.
262-
*/
263-
pragma[nomagic]
264-
deprecated predicate lastRead(Definition def, VariableReadAccessCfgNode read) {
265-
exists(Cfg::BasicBlock bb, int i |
266-
lastRefSkipUncertainReadsExt(def, bb, i) and
267-
variableReadActual(bb, i, _) and
268-
read = bb.getNode(i)
269-
)
270-
}
271-
272215
cached
273216
private module Cached {
274217
/**

shared/controlflow/codeql/controlflow/Cfg.qll

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,9 @@ module MakeWithSplitting<
252252
rank[i + 1](ControlFlowTree child, int j | child = this.getChildNode(j) | child order by j)
253253
}
254254

255-
/** Gets the first child node of this element. */
256-
deprecated final AstNode getFirstChildNode() { result = this.getChildTreeRanked(0) }
257-
258255
/** Gets the first child node of this element. */
259256
final ControlFlowTree getFirstChildTree() { result = this.getChildTreeRanked(0) }
260257

261-
/** Gets the last child node of this node. */
262-
deprecated final AstNode getLastChildElement() {
263-
exists(int last |
264-
result = this.getChildTreeRanked(last) and
265-
not exists(this.getChildTreeRanked(last + 1))
266-
)
267-
}
268-
269258
/** Gets the last child node of this node. */
270259
final ControlFlowTree getLastChildTree() {
271260
exists(int last |

shared/dataflow/codeql/dataflow/DataFlow.qll

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -784,19 +784,6 @@ private module DataFlowMakeCore<LocationSig Location, InputSig<Location> Lang> {
784784

785785
/** Gets the location of this node. */
786786
Location getLocation() { result = this.getNode().getLocation() }
787-
788-
/**
789-
* Holds if this element is at the specified location.
790-
* The location spans column `startcolumn` of line `startline` to
791-
* column `endcolumn` of line `endline` in file `filepath`.
792-
* For more information, see
793-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
794-
*/
795-
deprecated predicate hasLocationInfo(
796-
string filepath, int startline, int startcolumn, int endline, int endcolumn
797-
) {
798-
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
799-
}
800787
}
801788

802789
/**
@@ -853,19 +840,6 @@ private module DataFlowMakeCore<LocationSig Location, InputSig<Location> Lang> {
853840
/** Gets a textual representation of this element. */
854841
string toString() { result = super.toString() }
855842

856-
/**
857-
* Holds if this element is at the specified location.
858-
* The location spans column `startcolumn` of line `startline` to
859-
* column `endcolumn` of line `endline` in file `filepath`.
860-
* For more information, see
861-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
862-
*/
863-
deprecated predicate hasLocationInfo(
864-
string filepath, int startline, int startcolumn, int endline, int endcolumn
865-
) {
866-
super.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
867-
}
868-
869843
/** Gets the underlying `Node`. */
870844
Node getNode() { result = super.getNode() }
871845

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,36 +2531,6 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
25312531

25322532
/** Holds if this node is a sink. */
25332533
final predicate isSink() { this instanceof PathNodeSink }
2534-
2535-
/**
2536-
* Holds if this element is at the specified location.
2537-
* The location spans column `startcolumn` of line `startline` to
2538-
* column `endcolumn` of line `endline` in file `filepath`.
2539-
* For more information, see
2540-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
2541-
*/
2542-
overlay[caller?]
2543-
pragma[inline]
2544-
deprecated final predicate hasLocationInfo(
2545-
string filepath, int startline, int startcolumn, int endline, int endcolumn
2546-
) {
2547-
this.getLocation()
2548-
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
2549-
}
2550-
2551-
/**
2552-
* DEPRECATED: This functionality is no longer available.
2553-
*
2554-
* Holds if this node is a grouping of source nodes.
2555-
*/
2556-
deprecated final predicate isSourceGroup(string group) { none() }
2557-
2558-
/**
2559-
* DEPRECATED: This functionality is no longer available.
2560-
*
2561-
* Holds if this node is a grouping of sink nodes.
2562-
*/
2563-
deprecated final predicate isSinkGroup(string group) { none() }
25642534
}
25652535

25662536
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */

shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,6 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
2727
private import Aliases
2828

2929
module DataFlowImplCommonPublic {
30-
/**
31-
* DEPRECATED: Generally, a custom `FlowState` type should be used instead,
32-
* but `string` can of course still be used without referring to this
33-
* module.
34-
*
35-
* Provides `FlowState = string`.
36-
*/
37-
deprecated module FlowStateString {
38-
/** A state value to track during data flow. */
39-
deprecated class FlowState = string;
40-
41-
/**
42-
* The default state, which is used when the state is unspecified for a source
43-
* or a sink.
44-
*/
45-
deprecated class FlowStateEmpty extends FlowState {
46-
FlowStateEmpty() { this = "" }
47-
}
48-
}
49-
5030
private newtype TFlowFeature =
5131
TFeatureHasSourceCallContext() or
5232
TFeatureHasSinkCallContext() or

shared/dataflow/codeql/dataflow/internal/DataFlowImplStage1.qll

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,21 +1847,6 @@ module MakeImplStage1<LocationSig Location, InputSig<Location> Lang> {
18471847
/** Gets the location of this node. */
18481848
Location getLocation() { result = this.getNodeEx().getLocation() }
18491849

1850-
/**
1851-
* Holds if this element is at the specified location.
1852-
* The location spans column `startcolumn` of line `startline` to
1853-
* column `endcolumn` of line `endline` in file `filepath`.
1854-
* For more information, see
1855-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
1856-
*/
1857-
overlay[caller?]
1858-
pragma[inline]
1859-
deprecated predicate hasLocationInfo(
1860-
string filepath, int startline, int startcolumn, int endline, int endcolumn
1861-
) {
1862-
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
1863-
}
1864-
18651850
/** Gets the underlying `Node`. */
18661851
final Node getNode() { this.getNodeEx().projectToNode() = result }
18671852

0 commit comments

Comments
 (0)