Skip to content

Commit 5ded55c

Browse files
committed
C#: Sync Bound.qll
1 parent 283d6ef commit 5ded55c

File tree

1 file changed

+6
-16
lines changed
  • csharp/ql/lib/semmle/code/csharp/dataflow

1 file changed

+6
-16
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/Bound.qll

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,8 @@ abstract class Bound extends TBound {
2525
/** Gets an expression that equals this bound. */
2626
Expr getExpr() { result = this.getExpr(0) }
2727

28-
/**
29-
* Holds if this element is at the specified location.
30-
* The location spans column `sc` of line `sl` to
31-
* column `ec` of line `el` in file `path`.
32-
* For more information, see
33-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
34-
*/
35-
predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
36-
path = "" and sl = 0 and sc = 0 and el = 0 and ec = 0
37-
}
28+
/** Gets the location of this bound. */
29+
abstract Location getLocation();
3830
}
3931

4032
/**
@@ -45,6 +37,8 @@ class ZeroBound extends Bound, TBoundZero {
4537
override string toString() { result = "0" }
4638

4739
override Expr getExpr(int delta) { result.(ConstantIntegerExpr).getIntValue() = delta }
40+
41+
override Location getLocation() { result.hasLocationInfo("", 0, 0, 0, 0) }
4842
}
4943

5044
/**
@@ -58,9 +52,7 @@ class SsaBound extends Bound, TBoundSsa {
5852

5953
override Expr getExpr(int delta) { result = this.getSsa().getAUse() and delta = 0 }
6054

61-
override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
62-
this.getSsa().getLocation().hasLocationInfo(path, sl, sc, el, ec)
63-
}
55+
override Location getLocation() { result = this.getSsa().getLocation() }
6456
}
6557

6658
/**
@@ -72,7 +64,5 @@ class ExprBound extends Bound, TBoundExpr {
7264

7365
override Expr getExpr(int delta) { this = TBoundExpr(result) and delta = 0 }
7466

75-
override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
76-
this.getExpr().getLocation().hasLocationInfo(path, sl, sc, el, ec)
77-
}
67+
override Location getLocation() { result = this.getExpr().getLocation() }
7868
}

0 commit comments

Comments
 (0)