mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #6865 from MathiasVP/fix-if-none
C++/C#/JS/Python: Replace 'if p() then q() else none()' with a conjunction
This commit is contained in:
@@ -236,10 +236,9 @@ module RangeAnalysis {
|
||||
) {
|
||||
if exists(r.getImmediatePredecessor())
|
||||
then linearDefinitionSum(r.getImmediatePredecessor(), xroot, xsign, yroot, ysign, bias)
|
||||
else
|
||||
if exists(r.asExpr().getIntValue())
|
||||
then none() // do not model constants as sums
|
||||
else (
|
||||
else (
|
||||
not exists(r.asExpr().getIntValue()) and // do not model constants as sums
|
||||
(
|
||||
exists(AddExpr add, int bias1, int bias2 | r.asExpr() = add |
|
||||
// r = r1 + r2
|
||||
linearDefinition(add.getLeftOperand().flow(), xroot, xsign, bias1) and
|
||||
@@ -257,6 +256,7 @@ module RangeAnalysis {
|
||||
linearDefinitionSum(r.asExpr().(NegExpr).getOperand().flow(), xroot, -xsign, yroot, -ysign,
|
||||
-bias)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user