Skip to content

Commit 01c747c

Browse files
author
Dave Bartolomeo
committed
Remove debugging code
1 parent 820beed commit 01c747c

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/ModulusAnalysis.qll

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,6 @@ private predicate ssaModulus(SemSsaVariable v, SemSsaReadPosition pos, SemBound
211211
moduloGuardedRead(v, pos, val, mod) and b instanceof SemZeroBound
212212
}
213213

214-
predicate semExprModulus(SemExpr e, SemBound b, int val, int mod) {
215-
semExprModulus(e, b, val, mod, _)
216-
}
217-
218214
/**
219215
* Holds if `e` is equal to `b + val` modulo `mod`.
220216
*
@@ -223,28 +219,25 @@ predicate semExprModulus(SemExpr e, SemBound b, int val, int mod) {
223219
* - `mod > 1`: `val` lies within the range `[0 .. mod-1]`.
224220
*/
225221
cached
226-
predicate semExprModulus(SemExpr e, SemBound b, int val, int mod, string branch) {
222+
predicate semExprModulus(SemExpr e, SemBound b, int val, int mod) {
227223
not ignoreExprModulus(e) and
228224
(
229-
e = b.getExpr(val) and mod = 0 and branch = "getExpr"
225+
e = b.getExpr(val) and mod = 0
230226
or
231227
evenlyDivisibleExpr(e, mod) and
232228
val = 0 and
233-
b instanceof SemZeroBound and
234-
branch = "evenlyDivisible"
229+
b instanceof SemZeroBound
235230
or
236231
exists(SemSsaVariable v, SemSsaReadPositionBlock bb |
237232
ssaModulus(v, bb, b, val, mod) and
238233
e = v.getAUse() and
239-
bb.getAnExpr() = e and
240-
branch = "use"
234+
bb.getAnExpr() = e
241235
)
242236
or
243237
exists(SemExpr mid, int val0, int delta |
244238
semExprModulus(mid, b, val0, mod) and
245239
semValueFlowStep(e, mid, delta) and
246-
val = remainder(val0 + delta, mod) and
247-
branch = "valueFlowStep"
240+
val = remainder(val0 + delta, mod)
248241
)
249242
or
250243
exists(SemConditionalExpr cond, int v1, int v2, int m1, int m2 |
@@ -253,17 +246,15 @@ predicate semExprModulus(SemExpr e, SemBound b, int val, int mod, string branch)
253246
condExprBranchModulus(cond, false, b, v2, m2) and
254247
mod = m1.gcd(m2).gcd(v1 - v2) and
255248
mod != 1 and
256-
val = remainder(v1, mod) and
257-
branch = "condExpr"
249+
val = remainder(v1, mod)
258250
)
259251
or
260252
exists(SemBound b1, SemBound b2, int v1, int v2, int m1, int m2 |
261253
addModulus(e, true, b1, v1, m1) and
262254
addModulus(e, false, b2, v2, m2) and
263255
mod = m1.gcd(m2) and
264256
mod != 1 and
265-
val = remainder(v1 + v2, mod) and
266-
branch = "addModulus"
257+
val = remainder(v1 + v2, mod)
267258
|
268259
b = b1 and b2 instanceof SemZeroBound
269260
or
@@ -275,8 +266,7 @@ predicate semExprModulus(SemExpr e, SemBound b, int val, int mod, string branch)
275266
subModulus(e, false, any(SemZeroBound zb), v2, m2) and
276267
mod = m1.gcd(m2) and
277268
mod != 1 and
278-
val = remainder(v1 - v2, mod) and
279-
branch = "subModulus"
269+
val = remainder(v1 - v2, mod)
280270
)
281271
)
282272
}

0 commit comments

Comments
 (0)