diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/rangeanalysis/Bound.qll b/cpp/ql/lib/experimental/semmle/code/cpp/rangeanalysis/Bound.qll index abff447ca87..cca5f635ad6 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/rangeanalysis/Bound.qll +++ b/cpp/ql/lib/experimental/semmle/code/cpp/rangeanalysis/Bound.qll @@ -1,86 +1 @@ -import cpp -private import semmle.code.cpp.ir.IR -private import semmle.code.cpp.ir.ValueNumbering - -private newtype TBound = - TBoundZero() or - TBoundValueNumber(ValueNumber vn) { - exists(Instruction i | - vn.getAnInstruction() = i and - ( - i.getResultIRType() instanceof IRIntegerType or - i.getResultIRType() instanceof IRAddressType - ) and - not vn.getAnInstruction() instanceof ConstantInstruction - | - i instanceof PhiInstruction - or - i instanceof InitializeParameterInstruction - or - i instanceof CallInstruction - or - i instanceof VariableAddressInstruction - or - i instanceof FieldAddressInstruction - or - i.(LoadInstruction).getSourceAddress() instanceof VariableAddressInstruction - or - i.(LoadInstruction).getSourceAddress() instanceof FieldAddressInstruction - or - i.getAUse() instanceof ArgumentOperand - or - i instanceof PointerArithmeticInstruction - or - i.getAUse() instanceof AddressOperand - ) - } - -/** - * A bound that may be inferred for an expression plus/minus an integer delta. - */ -abstract class Bound extends TBound { - abstract string toString(); - - /** Gets an expression that equals this bound plus `delta`. */ - abstract Instruction getInstruction(int delta); - - /** Gets an expression that equals this bound. */ - Instruction getInstruction() { result = getInstruction(0) } - - abstract Location getLocation(); -} - -/** - * The bound that corresponds to the integer 0. This is used to represent all - * integer bounds as bounds are always accompanied by an added integer delta. - */ -class ZeroBound extends Bound, TBoundZero { - override string toString() { result = "0" } - - override Instruction getInstruction(int delta) { - result.(ConstantValueInstruction).getValue().toInt() = delta - } - - override Location getLocation() { result instanceof UnknownDefaultLocation } -} - -/** - * A bound corresponding to the value of an `Instruction`. - */ -class ValueNumberBound extends Bound, TBoundValueNumber { - ValueNumber vn; - - ValueNumberBound() { this = TBoundValueNumber(vn) } - - /** Gets an `Instruction` that equals this bound. */ - override Instruction getInstruction(int delta) { - this = TBoundValueNumber(valueNumber(result)) and delta = 0 - } - - override string toString() { result = "ValueNumberBound" } - - override Location getLocation() { result = vn.getLocation() } - - /** Gets the value number that equals this bound. */ - ValueNumber getValueNumber() { result = vn } -} +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.Bound diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysis.qll b/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysis.qll deleted file mode 100644 index e9b7d9dc2ac..00000000000 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysis.qll +++ /dev/null @@ -1,2 +0,0 @@ -import RangeAnalysisImpl -import experimental.semmle.code.cpp.semantic.SemanticBound diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SimpleRangeAnalysis.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/SimpleRangeAnalysis.qll similarity index 94% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SimpleRangeAnalysis.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/SimpleRangeAnalysis.qll index bd234390e3d..04cb8a5a3fa 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SimpleRangeAnalysis.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/SimpleRangeAnalysis.qll @@ -5,9 +5,9 @@ private import cpp private import semmle.code.cpp.ir.IR -private import experimental.semmle.code.cpp.semantic.SemanticBound -private import experimental.semmle.code.cpp.semantic.SemanticExprSpecific -private import RangeAnalysis +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticBound +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysis /** * Gets the lower bound of the expression. diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/Semantic.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/Semantic.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/Semantic.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/Semantic.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticBound.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticBound.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticBound.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticBound.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticCFG.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticCFG.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticCFG.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticCFG.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExpr.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticExpr.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExpr.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticExpr.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExprSpecific.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticExprSpecific.qll similarity index 99% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExprSpecific.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticExprSpecific.qll index 0b3249a3013..6ac6081c558 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExprSpecific.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticExprSpecific.qll @@ -5,7 +5,7 @@ private import cpp as Cpp private import semmle.code.cpp.ir.IR as IR private import Semantic -private import experimental.semmle.code.cpp.rangeanalysis.Bound as IRBound +private import analysis.Bound as IRBound private import semmle.code.cpp.controlflow.IRGuards as IRGuards private import semmle.code.cpp.ir.ValueNumbering diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticGuard.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticGuard.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticGuard.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticGuard.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticLocation.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticLocation.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticLocation.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticLocation.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticOpcode.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticOpcode.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticOpcode.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticOpcode.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticSSA.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticSSA.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticSSA.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticSSA.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticType.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticType.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticType.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticType.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticTypeSpecific.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticTypeSpecific.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticTypeSpecific.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticTypeSpecific.qll diff --git a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Bound.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Bound.qll new file mode 100644 index 00000000000..abff447ca87 --- /dev/null +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Bound.qll @@ -0,0 +1,86 @@ +import cpp +private import semmle.code.cpp.ir.IR +private import semmle.code.cpp.ir.ValueNumbering + +private newtype TBound = + TBoundZero() or + TBoundValueNumber(ValueNumber vn) { + exists(Instruction i | + vn.getAnInstruction() = i and + ( + i.getResultIRType() instanceof IRIntegerType or + i.getResultIRType() instanceof IRAddressType + ) and + not vn.getAnInstruction() instanceof ConstantInstruction + | + i instanceof PhiInstruction + or + i instanceof InitializeParameterInstruction + or + i instanceof CallInstruction + or + i instanceof VariableAddressInstruction + or + i instanceof FieldAddressInstruction + or + i.(LoadInstruction).getSourceAddress() instanceof VariableAddressInstruction + or + i.(LoadInstruction).getSourceAddress() instanceof FieldAddressInstruction + or + i.getAUse() instanceof ArgumentOperand + or + i instanceof PointerArithmeticInstruction + or + i.getAUse() instanceof AddressOperand + ) + } + +/** + * A bound that may be inferred for an expression plus/minus an integer delta. + */ +abstract class Bound extends TBound { + abstract string toString(); + + /** Gets an expression that equals this bound plus `delta`. */ + abstract Instruction getInstruction(int delta); + + /** Gets an expression that equals this bound. */ + Instruction getInstruction() { result = getInstruction(0) } + + abstract Location getLocation(); +} + +/** + * The bound that corresponds to the integer 0. This is used to represent all + * integer bounds as bounds are always accompanied by an added integer delta. + */ +class ZeroBound extends Bound, TBoundZero { + override string toString() { result = "0" } + + override Instruction getInstruction(int delta) { + result.(ConstantValueInstruction).getValue().toInt() = delta + } + + override Location getLocation() { result instanceof UnknownDefaultLocation } +} + +/** + * A bound corresponding to the value of an `Instruction`. + */ +class ValueNumberBound extends Bound, TBoundValueNumber { + ValueNumber vn; + + ValueNumberBound() { this = TBoundValueNumber(vn) } + + /** Gets an `Instruction` that equals this bound. */ + override Instruction getInstruction(int delta) { + this = TBoundValueNumber(valueNumber(result)) and delta = 0 + } + + override string toString() { result = "ValueNumberBound" } + + override Location getLocation() { result = vn.getLocation() } + + /** Gets the value number that equals this bound. */ + ValueNumber getValueNumber() { result = vn } +} diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ConstantAnalysis.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ConstantAnalysis.qll similarity index 91% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ConstantAnalysis.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ConstantAnalysis.qll index 2cfa99ae30a..c01b64e73d6 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ConstantAnalysis.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ConstantAnalysis.qll @@ -2,7 +2,7 @@ * Simple constant analysis using the Semantic interface. */ -private import experimental.semmle.code.cpp.semantic.Semantic +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic private import ConstantAnalysisSpecific as Specific /** An expression that always has the same integer value. */ diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ConstantAnalysisSpecific.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ConstantAnalysisSpecific.qll similarity index 71% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ConstantAnalysisSpecific.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ConstantAnalysisSpecific.qll index cd7f96d6557..4713a10ebfc 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ConstantAnalysisSpecific.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ConstantAnalysisSpecific.qll @@ -2,7 +2,7 @@ * C++-specific implementation of constant analysis. */ -private import experimental.semmle.code.cpp.semantic.Semantic +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic /** * Gets the constant integer value of the specified expression, if any. diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/FloatDelta.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/FloatDelta.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/FloatDelta.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/FloatDelta.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/IntDelta.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/IntDelta.qll similarity index 100% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/IntDelta.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/IntDelta.qll diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ModulusAnalysis.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ModulusAnalysis.qll similarity index 99% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ModulusAnalysis.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ModulusAnalysis.qll index acb5436e9c9..a05e948a2b0 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ModulusAnalysis.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ModulusAnalysis.qll @@ -11,7 +11,7 @@ */ private import ModulusAnalysisSpecific::Private -private import experimental.semmle.code.cpp.semantic.Semantic +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic private import ConstantAnalysis private import RangeUtils private import RangeAnalysisStage diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ModulusAnalysisSpecific.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ModulusAnalysisSpecific.qll similarity index 62% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ModulusAnalysisSpecific.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ModulusAnalysisSpecific.qll index a2fb5598e0e..c0e7287e23b 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ModulusAnalysisSpecific.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/ModulusAnalysisSpecific.qll @@ -2,7 +2,7 @@ * C++-specific implementation of modulus analysis. */ module Private { - private import experimental.semmle.code.cpp.semantic.Semantic + private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic predicate ignoreExprModulus(SemExpr e) { none() } } diff --git a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysis.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysis.qll new file mode 100644 index 00000000000..5d15aa30fb4 --- /dev/null +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysis.qll @@ -0,0 +1,2 @@ +import RangeAnalysisImpl +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticBound diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisImpl.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisImpl.qll similarity index 91% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisImpl.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisImpl.qll index 49b8541b17f..dd3a0f2e878 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisImpl.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisImpl.qll @@ -1,10 +1,10 @@ private import RangeAnalysisStage private import RangeAnalysisSpecific -private import experimental.semmle.code.cpp.semantic.analysis.FloatDelta +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.FloatDelta private import RangeUtils -private import experimental.semmle.code.cpp.semantic.SemanticBound as SemanticBound -private import experimental.semmle.code.cpp.semantic.SemanticLocation -private import experimental.semmle.code.cpp.semantic.SemanticSSA +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticBound as SemanticBound +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticLocation +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticSSA module ConstantBounds implements BoundSig { class SemBound instanceof SemanticBound::SemBound { diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisSpecific.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisSpecific.qll similarity index 95% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisSpecific.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisSpecific.qll index 34d5bca116b..2ddc20c8a33 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisSpecific.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisSpecific.qll @@ -2,9 +2,9 @@ * C++-specific implementation of range analysis. */ -private import experimental.semmle.code.cpp.semantic.Semantic +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic private import RangeAnalysisStage -private import experimental.semmle.code.cpp.semantic.analysis.FloatDelta +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.FloatDelta module CppLangImpl implements LangSig { /** diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisStage.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisStage.qll similarity index 98% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisStage.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisStage.qll index c544dec893f..2cdf7b1e233 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisStage.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisStage.qll @@ -65,15 +65,15 @@ private import RangeUtils as Utils private import SignAnalysisCommon -private import experimental.semmle.code.cpp.semantic.analysis.ModulusAnalysis -import experimental.semmle.code.cpp.semantic.SemanticExpr -import experimental.semmle.code.cpp.semantic.SemanticSSA -import experimental.semmle.code.cpp.semantic.SemanticGuard -import experimental.semmle.code.cpp.semantic.SemanticCFG -import experimental.semmle.code.cpp.semantic.SemanticType -import experimental.semmle.code.cpp.semantic.SemanticOpcode +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.ModulusAnalysis +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExpr +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticSSA +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticGuard +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticCFG +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticType +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticOpcode private import ConstantAnalysis -import experimental.semmle.code.cpp.semantic.SemanticLocation +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticLocation /** * Holds if `typ` is a small integral type with the given lower and upper bounds. diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeUtils.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeUtils.qll similarity index 98% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeUtils.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeUtils.qll index d9cc2cc9a71..7eeed5d7975 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeUtils.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeUtils.qll @@ -2,7 +2,7 @@ * Provides utility predicates for range analysis. */ -private import experimental.semmle.code.cpp.semantic.Semantic +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic private import RangeAnalysisSpecific private import RangeAnalysisStage as Range private import ConstantAnalysis diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/Sign.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Sign.qll similarity index 98% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/Sign.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Sign.qll index 692a812911c..814691d9bcd 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/Sign.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/Sign.qll @@ -1,4 +1,4 @@ -private import experimental.semmle.code.cpp.semantic.Semantic +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic newtype TSign = TNeg() or diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisCommon.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/SignAnalysisCommon.qll similarity index 99% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisCommon.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/SignAnalysisCommon.qll index ec3427558d4..9abcdc842ab 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisCommon.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/SignAnalysisCommon.qll @@ -8,7 +8,7 @@ private import RangeAnalysisStage private import SignAnalysisSpecific as Specific -private import experimental.semmle.code.cpp.semantic.Semantic +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic private import ConstantAnalysis private import RangeUtils private import Sign diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisSpecific.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/SignAnalysisSpecific.qll similarity index 88% rename from cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisSpecific.qll rename to cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/SignAnalysisSpecific.qll index 0f482790d4d..8bdb9dbc6b9 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisSpecific.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/SignAnalysisSpecific.qll @@ -2,7 +2,7 @@ * Provides C++-specific definitions for use in sign analysis. */ -private import experimental.semmle.code.cpp.semantic.Semantic +private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic /** * Workaround to allow certain expressions to have a negative sign, even if the type of the diff --git a/cpp/ql/src/experimental/Likely Bugs/ArrayAccessProductFlow.ql b/cpp/ql/src/experimental/Likely Bugs/ArrayAccessProductFlow.ql index 61c0af6be26..39c54573b06 100644 --- a/cpp/ql/src/experimental/Likely Bugs/ArrayAccessProductFlow.ql +++ b/cpp/ql/src/experimental/Likely Bugs/ArrayAccessProductFlow.ql @@ -11,9 +11,9 @@ import cpp import experimental.semmle.code.cpp.dataflow.ProductFlow -import experimental.semmle.code.cpp.semantic.analysis.RangeAnalysis -import experimental.semmle.code.cpp.rangeanalysis.Bound -import experimental.semmle.code.cpp.semantic.SemanticExprSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysis +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.Bound import semmle.code.cpp.ir.IR import semmle.code.cpp.valuenumbering.GlobalValueNumbering import semmle.code.cpp.models.interfaces.Allocation diff --git a/cpp/ql/src/experimental/Likely Bugs/OverrunWriteProductFlow.ql b/cpp/ql/src/experimental/Likely Bugs/OverrunWriteProductFlow.ql index 5f6bf7d7166..7fde728e5bf 100644 --- a/cpp/ql/src/experimental/Likely Bugs/OverrunWriteProductFlow.ql +++ b/cpp/ql/src/experimental/Likely Bugs/OverrunWriteProductFlow.ql @@ -17,9 +17,8 @@ import experimental.semmle.code.cpp.dataflow.ProductFlow import semmle.code.cpp.ir.IR import semmle.code.cpp.models.interfaces.Allocation import semmle.code.cpp.models.interfaces.ArrayFunction -import experimental.semmle.code.cpp.semantic.analysis.RangeAnalysis -import experimental.semmle.code.cpp.semantic.SemanticBound -import experimental.semmle.code.cpp.semantic.SemanticExprSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysis +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific import DataFlow::PathGraph pragma[nomagic] diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql b/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql index 66346b7aea7..20cd6f639ef 100644 --- a/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql +++ b/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql @@ -10,9 +10,8 @@ * experimental */ -import experimental.semmle.code.cpp.semantic.analysis.RangeAnalysis -import experimental.semmle.code.cpp.semantic.SemanticBound -import experimental.semmle.code.cpp.semantic.SemanticExprSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysis +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific import semmle.code.cpp.ir.IR import semmle.code.cpp.ir.dataflow.DataFlow import PointerArithmeticToDerefFlow::PathGraph diff --git a/cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql b/cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql index 4f1fdb5d08a..1fefbbfcf36 100644 --- a/cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql +++ b/cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql @@ -17,9 +17,8 @@ import cpp import experimental.semmle.code.cpp.dataflow.ProductFlow -import experimental.semmle.code.cpp.semantic.analysis.RangeAnalysis -import experimental.semmle.code.cpp.semantic.SemanticBound -import experimental.semmle.code.cpp.semantic.SemanticExprSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysis +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific import semmle.code.cpp.ir.IR pragma[nomagic] diff --git a/cpp/ql/test/library-tests/ir/modulus-analysis/ModulusAnalysis.ql b/cpp/ql/test/library-tests/ir/modulus-analysis/ModulusAnalysis.ql index e7c56c240df..30ca575b767 100644 --- a/cpp/ql/test/library-tests/ir/modulus-analysis/ModulusAnalysis.ql +++ b/cpp/ql/test/library-tests/ir/modulus-analysis/ModulusAnalysis.ql @@ -1,11 +1,11 @@ import cpp -import experimental.semmle.code.cpp.semantic.analysis.ModulusAnalysis -import experimental.semmle.code.cpp.semantic.Semantic -import experimental.semmle.code.cpp.semantic.analysis.RangeUtils -import experimental.semmle.code.cpp.semantic.analysis.FloatDelta -import experimental.semmle.code.cpp.semantic.analysis.RangeAnalysisSpecific -import experimental.semmle.code.cpp.semantic.analysis.RangeAnalysisImpl -import experimental.semmle.code.cpp.semantic.SemanticExprSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.ModulusAnalysis +import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeUtils +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.FloatDelta +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysisSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysisImpl +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific import semmle.code.cpp.ir.IR as IR import TestUtilities.InlineExpectationsTest diff --git a/cpp/ql/test/library-tests/ir/range-analysis/RangeAnalysis.ql b/cpp/ql/test/library-tests/ir/range-analysis/RangeAnalysis.ql index 9cae7bf9e72..6c79e56cc5b 100644 --- a/cpp/ql/test/library-tests/ir/range-analysis/RangeAnalysis.ql +++ b/cpp/ql/test/library-tests/ir/range-analysis/RangeAnalysis.ql @@ -1,7 +1,7 @@ import cpp -import experimental.semmle.code.cpp.semantic.analysis.RangeAnalysis -import experimental.semmle.code.cpp.semantic.Semantic -import experimental.semmle.code.cpp.semantic.SemanticExprSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysis +import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific import semmle.code.cpp.ir.IR as IR import TestUtilities.InlineExpectationsTest diff --git a/cpp/ql/test/library-tests/ir/sign-analysis/SignAnalysis.ql b/cpp/ql/test/library-tests/ir/sign-analysis/SignAnalysis.ql index 7b78b077a9b..8f95759ec7d 100644 --- a/cpp/ql/test/library-tests/ir/sign-analysis/SignAnalysis.ql +++ b/cpp/ql/test/library-tests/ir/sign-analysis/SignAnalysis.ql @@ -1,10 +1,10 @@ import cpp -import experimental.semmle.code.cpp.semantic.analysis.SignAnalysisCommon -import experimental.semmle.code.cpp.semantic.Semantic -import experimental.semmle.code.cpp.semantic.analysis.RangeUtils -import experimental.semmle.code.cpp.semantic.analysis.FloatDelta -import experimental.semmle.code.cpp.semantic.analysis.RangeAnalysisSpecific -import experimental.semmle.code.cpp.semantic.SemanticExprSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.SignAnalysisCommon +import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeUtils +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.FloatDelta +import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysisSpecific +import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific import semmle.code.cpp.ir.IR as IR import TestUtilities.InlineExpectationsTest