Skip to content

Commit aa78c6e

Browse files
committed
C++: Move to experimental
And rename to `SimpleRangeAnalysisExpr` to clarify which of our range analysis libraries this belongs to.
1 parent cdddf5f commit aa78c6e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

cpp/ql/src/semmle/code/cpp/models/interfaces/RangeAnalysisExpr.qll renamed to cpp/ql/src/experimental/semmle/code/cpp/models/interfaces/SimpleRangeAnalysisExpr.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import cpp
66
/**
77
* An expression for which a range can be deduced.
88
*/
9-
abstract class RangeAnalysisExpr extends Expr {
9+
abstract class SimpleRangeAnalysisExpr extends Expr {
1010
/** Gets the lower bound of the expression. */
1111
abstract float getLowerBounds();
1212
/** Gets the upper bound of the expression. */
1313
abstract float getUpperBounds();
1414
/** Holds if this expression depends on the definition `srcDef` for StackVariable `srcVar`. */
1515
predicate dependsOnDef(RangeSsaDefinition srcDef, StackVariable srcVar) { none() }
16-
}
16+
}

cpp/ql/src/semmle/code/cpp/rangeanalysis/SimpleRangeAnalysis.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
import cpp
4646
private import RangeAnalysisUtils
47-
private import semmle.code.cpp.models.interfaces.RangeAnalysisExpr
47+
private import experimental.semmle.code.cpp.models.interfaces.SimpleRangeAnalysisExpr
4848
import RangeSSA
4949
import SimpleRangeAnalysisCached
5050
private import NanAnalysis
@@ -216,7 +216,7 @@ private predicate analyzableExpr(Expr e) {
216216
exists(e.(RShiftExpr).getRightOperand().getValue())
217217
or
218218
// A modeled expression for range analysis
219-
e instanceof RangeAnalysisExpr
219+
e instanceof SimpleRangeAnalysisExpr
220220
)
221221
}
222222

@@ -334,7 +334,7 @@ private predicate exprDependsOnDef(Expr e, RangeSsaDefinition srcDef, StackVaria
334334
e = srcDef.getAUse(srcVar)
335335
or
336336
// A modeled expression for range analysis
337-
exists(RangeAnalysisExpr rae |
337+
exists(SimpleRangeAnalysisExpr rae |
338338
rae.dependsOnDef(srcDef, srcVar)
339339
)
340340
}
@@ -738,8 +738,8 @@ private float getLowerBoundsImpl(Expr expr) {
738738
// Use SSA to get the lower bounds for a variable use.
739739
exists(RangeSsaDefinition def, StackVariable v | expr = def.getAUse(v) |
740740
result = getDefLowerBounds(def, v) and
741-
// Not explicitly modeled by a RangeAnalysisExpr
742-
not expr instanceof RangeAnalysisExpr
741+
// Not explicitly modeled by a SimpleRangeAnalysisExpr
742+
not expr instanceof SimpleRangeAnalysisExpr
743743
)
744744
or
745745
// unsigned `&` (tighter bounds may exist)
@@ -757,7 +757,7 @@ private float getLowerBoundsImpl(Expr expr) {
757757
)
758758
or
759759
// A modeled expression for range analysis
760-
exists(RangeAnalysisExpr rangeAnalysisExpr |
760+
exists(SimpleRangeAnalysisExpr rangeAnalysisExpr |
761761
rangeAnalysisExpr = expr and
762762
result = rangeAnalysisExpr.getLowerBounds()
763763
)
@@ -920,8 +920,8 @@ private float getUpperBoundsImpl(Expr expr) {
920920
// Use SSA to get the upper bounds for a variable use.
921921
exists(RangeSsaDefinition def, StackVariable v | expr = def.getAUse(v) |
922922
result = getDefUpperBounds(def, v) and
923-
// Not explicitly modeled by a RangeAnalysisExpr
924-
not expr instanceof RangeAnalysisExpr
923+
// Not explicitly modeled by a SimpleRangeAnalysisExpr
924+
not expr instanceof SimpleRangeAnalysisExpr
925925
)
926926
or
927927
// unsigned `&` (tighter bounds may exist)
@@ -941,7 +941,7 @@ private float getUpperBoundsImpl(Expr expr) {
941941
)
942942
or
943943
// A modeled expression for range analysis
944-
exists(RangeAnalysisExpr rangeAnalysisExpr |
944+
exists(SimpleRangeAnalysisExpr rangeAnalysisExpr |
945945
rangeAnalysisExpr = expr and
946946
result = rangeAnalysisExpr.getUpperBounds()
947947
)

0 commit comments

Comments
 (0)