Skip to content

Commit 3a73faf

Browse files
committed
Rangeanalysis: Remove unused getAlternateType predicates.
1 parent 352ec91 commit 3a73faf

File tree

5 files changed

+2
-68
lines changed

5 files changed

+2
-68
lines changed

cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisConstantSpecific.qll

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,4 @@ module CppLangImplConstant implements LangSig<Sem, FloatDelta> {
2525
* Holds if `e >= bound + delta` (if `upper = false`) or `e <= bound + delta` (if `upper = true`).
2626
*/
2727
predicate hasBound(SemExpr e, SemExpr bound, float delta, boolean upper) { none() }
28-
29-
/**
30-
* Gets the type that range analysis should use to track the result of the specified expression,
31-
* if a type other than the original type of the expression is to be used.
32-
*
33-
* This predicate is commonly used in languages that support immutable "boxed" types that are
34-
* actually references but whose values can be tracked as the type contained in the box.
35-
*/
36-
SemType getAlternateType(SemExpr e) { none() }
37-
38-
/**
39-
* Gets the type that range analysis should use to track the result of the specified source
40-
* variable, if a type other than the original type of the expression is to be used.
41-
*
42-
* This predicate is commonly used in languages that support immutable "boxed" types that are
43-
* actually references but whose values can be tracked as the type contained in the box.
44-
*/
45-
SemType getAlternateTypeForSsaVariable(SemSsaVariable var) { none() }
4628
}

cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisRelativeSpecific.qll

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,4 @@ module CppLangImplRelative implements LangSig<Sem, FloatDelta> {
5757
* Holds if `e >= bound + delta` (if `upper = false`) or `e <= bound + delta` (if `upper = true`).
5858
*/
5959
predicate hasBound(SemExpr e, SemExpr bound, float delta, boolean upper) { none() }
60-
61-
/**
62-
* Gets the type that range analysis should use to track the result of the specified expression,
63-
* if a type other than the original type of the expression is to be used.
64-
*
65-
* This predicate is commonly used in languages that support immutable "boxed" types that are
66-
* actually references but whose values can be tracked as the type contained in the box.
67-
*/
68-
SemType getAlternateType(SemExpr e) { none() }
69-
70-
/**
71-
* Gets the type that range analysis should use to track the result of the specified source
72-
* variable, if a type other than the original type of the expression is to be used.
73-
*
74-
* This predicate is commonly used in languages that support immutable "boxed" types that are
75-
* actually references but whose values can be tracked as the type contained in the box.
76-
*/
77-
SemType getAlternateTypeForSsaVariable(SemSsaVariable var) { none() }
7860
}

cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeUtils.qll

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,13 @@ module RangeUtil<DeltaSig D, LangSig<Sem, D> Lang> implements UtilSig<Sem, D> {
1515
* Usually, this just `e.getSemType()`, but the language can override this to track immutable boxed
1616
* primitive types as the underlying primitive type.
1717
*/
18-
SemType getTrackedType(SemExpr e) {
19-
result = Lang::getAlternateType(e)
20-
or
21-
not exists(Lang::getAlternateType(e)) and result = e.getSemType()
22-
}
18+
SemType getTrackedType(SemExpr e) { result = e.getSemType() }
2319

2420
/**
2521
* Gets the type used to track the specified source variable's range information.
2622
*
2723
* Usually, this just `e.getType()`, but the language can override this to track immutable boxed
2824
* primitive types as the underlying primitive type.
2925
*/
30-
SemType getTrackedTypeForSsaVariable(SemSsaVariable var) {
31-
result = Lang::getAlternateTypeForSsaVariable(var)
32-
or
33-
not exists(Lang::getAlternateTypeForSsaVariable(var)) and result = var.getType()
34-
}
26+
SemType getTrackedTypeForSsaVariable(SemSsaVariable var) { result = var.getType() }
3527
}

java/ql/lib/semmle/code/java/dataflow/RangeAnalysis.qll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,6 @@ module JavaLangImpl implements LangSig<Sem, IntDelta> {
362362

363363
predicate ignoreExprBound(Sem::Expr e) { none() }
364364

365-
Sem::Type getAlternateType(Sem::Expr e) { none() }
366-
367-
Sem::Type getAlternateTypeForSsaVariable(Sem::SsaVariable var) { none() }
368-
369365
predicate javaCompatibility() { any() }
370366
}
371367

shared/rangeanalysis/codeql/rangeanalysis/RangeAnalysis.qll

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -282,24 +282,6 @@ signature module LangSig<Semantic Sem, DeltaSig D> {
282282
*/
283283
predicate ignoreExprBound(Sem::Expr e);
284284

285-
/**
286-
* Gets the type that range analysis should use to track the result of the specified expression,
287-
* if a type other than the original type of the expression is to be used.
288-
*
289-
* This predicate is commonly used in languages that support immutable "boxed" types that are
290-
* actually references but whose values can be tracked as the type contained in the box.
291-
*/
292-
Sem::Type getAlternateType(Sem::Expr e);
293-
294-
/**
295-
* Gets the type that range analysis should use to track the result of the specified source
296-
* variable, if a type other than the original type of the expression is to be used.
297-
*
298-
* This predicate is commonly used in languages that support immutable "boxed" types that are
299-
* actually references but whose values can be tracked as the type contained in the box.
300-
*/
301-
Sem::Type getAlternateTypeForSsaVariable(Sem::SsaVariable var);
302-
303285
default predicate javaCompatibility() { none() }
304286
}
305287

0 commit comments

Comments
 (0)