зеркало из https://github.com/github/codeql.git
Apply suggestions from code review
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
This commit is contained in:
Родитель
15953bf569
Коммит
6ed895064f
|
@ -1,7 +1,9 @@
|
|||
public class B {
|
||||
public int forloop() {
|
||||
int result = 0;
|
||||
for (int i = 0; i < 10; i++) {// $ bound="i in [0..10]" bound="i in [0..9]"
|
||||
for (int i = 0;
|
||||
i < 10; // $ bound="i in [0..10]"
|
||||
i++) { // $ bound="i in [0..9]"
|
||||
result = i; // $ bound="i in [0..9]"
|
||||
}
|
||||
return result; // $ bound="result in [0..9]"
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
|
||||
import java
|
||||
import semmle.code.java.dataflow.RangeAnalysis
|
||||
private import codeql.util.test.InlineExpectationsTest
|
||||
private import TestUtilities.internal.InlineExpectationsTestImpl
|
||||
private import Make<Impl> as IET
|
||||
private import TestUtilities.InlineExpectationsTest as IET
|
||||
|
||||
module RangeTest implements IET::TestSig {
|
||||
string getARelevantTag() { result = "bound" }
|
||||
|
@ -29,8 +27,8 @@ module RangeTest implements IET::TestSig {
|
|||
}
|
||||
|
||||
private predicate constrained(Expr e, int lower, int upper) {
|
||||
lower = min(int delta | bounded(e, any(ZeroBound z), delta, false, _)) and
|
||||
upper = min(int delta | bounded(e, any(ZeroBound z), delta, true, _))
|
||||
bounded(e, any(ZeroBound z), lower, false, _) and
|
||||
bounded(e, any(ZeroBound z), upper, true, _)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче