C++: Move to experimental

And rename to `SimpleRangeAnalysisExpr` to clarify which of our range
analysis libraries this belongs to.
This commit is contained in:
Jonas Jensen
2020-08-13 16:12:43 +02:00
parent cdddf5fd40
commit aa78c6e750
2 changed files with 11 additions and 11 deletions

View File

@@ -6,11 +6,11 @@ import cpp
/** /**
* An expression for which a range can be deduced. * An expression for which a range can be deduced.
*/ */
abstract class RangeAnalysisExpr extends Expr { abstract class SimpleRangeAnalysisExpr extends Expr {
/** Gets the lower bound of the expression. */ /** Gets the lower bound of the expression. */
abstract float getLowerBounds(); abstract float getLowerBounds();
/** Gets the upper bound of the expression. */ /** Gets the upper bound of the expression. */
abstract float getUpperBounds(); abstract float getUpperBounds();
/** Holds if this expression depends on the definition `srcDef` for StackVariable `srcVar`. */ /** Holds if this expression depends on the definition `srcDef` for StackVariable `srcVar`. */
predicate dependsOnDef(RangeSsaDefinition srcDef, StackVariable srcVar) { none() } predicate dependsOnDef(RangeSsaDefinition srcDef, StackVariable srcVar) { none() }
} }

View File

@@ -44,7 +44,7 @@
import cpp import cpp
private import RangeAnalysisUtils private import RangeAnalysisUtils
private import semmle.code.cpp.models.interfaces.RangeAnalysisExpr private import experimental.semmle.code.cpp.models.interfaces.SimpleRangeAnalysisExpr
import RangeSSA import RangeSSA
import SimpleRangeAnalysisCached import SimpleRangeAnalysisCached
private import NanAnalysis private import NanAnalysis
@@ -216,7 +216,7 @@ private predicate analyzableExpr(Expr e) {
exists(e.(RShiftExpr).getRightOperand().getValue()) exists(e.(RShiftExpr).getRightOperand().getValue())
or or
// A modeled expression for range analysis // A modeled expression for range analysis
e instanceof RangeAnalysisExpr e instanceof SimpleRangeAnalysisExpr
) )
} }
@@ -334,7 +334,7 @@ private predicate exprDependsOnDef(Expr e, RangeSsaDefinition srcDef, StackVaria
e = srcDef.getAUse(srcVar) e = srcDef.getAUse(srcVar)
or or
// A modeled expression for range analysis // A modeled expression for range analysis
exists(RangeAnalysisExpr rae | exists(SimpleRangeAnalysisExpr rae |
rae.dependsOnDef(srcDef, srcVar) rae.dependsOnDef(srcDef, srcVar)
) )
} }
@@ -738,8 +738,8 @@ private float getLowerBoundsImpl(Expr expr) {
// Use SSA to get the lower bounds for a variable use. // Use SSA to get the lower bounds for a variable use.
exists(RangeSsaDefinition def, StackVariable v | expr = def.getAUse(v) | exists(RangeSsaDefinition def, StackVariable v | expr = def.getAUse(v) |
result = getDefLowerBounds(def, v) and result = getDefLowerBounds(def, v) and
// Not explicitly modeled by a RangeAnalysisExpr // Not explicitly modeled by a SimpleRangeAnalysisExpr
not expr instanceof RangeAnalysisExpr not expr instanceof SimpleRangeAnalysisExpr
) )
or or
// unsigned `&` (tighter bounds may exist) // unsigned `&` (tighter bounds may exist)
@@ -757,7 +757,7 @@ private float getLowerBoundsImpl(Expr expr) {
) )
or or
// A modeled expression for range analysis // A modeled expression for range analysis
exists(RangeAnalysisExpr rangeAnalysisExpr | exists(SimpleRangeAnalysisExpr rangeAnalysisExpr |
rangeAnalysisExpr = expr and rangeAnalysisExpr = expr and
result = rangeAnalysisExpr.getLowerBounds() result = rangeAnalysisExpr.getLowerBounds()
) )
@@ -920,8 +920,8 @@ private float getUpperBoundsImpl(Expr expr) {
// Use SSA to get the upper bounds for a variable use. // Use SSA to get the upper bounds for a variable use.
exists(RangeSsaDefinition def, StackVariable v | expr = def.getAUse(v) | exists(RangeSsaDefinition def, StackVariable v | expr = def.getAUse(v) |
result = getDefUpperBounds(def, v) and result = getDefUpperBounds(def, v) and
// Not explicitly modeled by a RangeAnalysisExpr // Not explicitly modeled by a SimpleRangeAnalysisExpr
not expr instanceof RangeAnalysisExpr not expr instanceof SimpleRangeAnalysisExpr
) )
or or
// unsigned `&` (tighter bounds may exist) // unsigned `&` (tighter bounds may exist)
@@ -941,7 +941,7 @@ private float getUpperBoundsImpl(Expr expr) {
) )
or or
// A modeled expression for range analysis // A modeled expression for range analysis
exists(RangeAnalysisExpr rangeAnalysisExpr | exists(SimpleRangeAnalysisExpr rangeAnalysisExpr |
rangeAnalysisExpr = expr and rangeAnalysisExpr = expr and
result = rangeAnalysisExpr.getUpperBounds() result = rangeAnalysisExpr.getUpperBounds()
) )