Skip to content

Commit 1cd3272

Browse files
committed
Java: More review fixes.
1 parent 9d59f50 commit 1cd3272

File tree

1 file changed

+21
-36
lines changed

1 file changed

+21
-36
lines changed

shared/dataflow/codeql/dataflow/VariableCapture.qll

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -299,30 +299,24 @@ module Flow<InputSig Input> implements OutputSig<Input> {
299299
)
300300
}
301301

302-
query predicate uniqueEnclosingCallable(BasicBlock bb, string msg) {
303-
bb instanceof RelevantBasicBlock and
304-
(
305-
msg = "BasicBlock has no enclosing callable" and not exists(bb.getEnclosingCallable())
306-
or
307-
msg = "BasicBlock has multiple enclosing callables" and
308-
2 <= strictcount(bb.getEnclosingCallable())
309-
)
302+
query predicate uniqueEnclosingCallable(RelevantBasicBlock bb, string msg) {
303+
msg = "BasicBlock has no enclosing callable" and not exists(bb.getEnclosingCallable())
304+
or
305+
msg = "BasicBlock has multiple enclosing callables" and
306+
2 <= strictcount(bb.getEnclosingCallable())
310307
}
311308

312-
query predicate uniqueDominator(BasicBlock bb, string msg) {
313-
bb instanceof RelevantBasicBlock and
309+
query predicate uniqueDominator(RelevantBasicBlock bb, string msg) {
314310
msg = "BasicBlock has multiple immediate dominators" and
315311
2 <= strictcount(getImmediateBasicBlockDominator(bb))
316312
}
317313

318-
query predicate localDominator(BasicBlock bb, string msg) {
319-
bb instanceof RelevantBasicBlock and
314+
query predicate localDominator(RelevantBasicBlock bb, string msg) {
320315
msg = "BasicBlock has non-local dominator" and
321316
bb.getEnclosingCallable() != getImmediateBasicBlockDominator(bb).getEnclosingCallable()
322317
}
323318

324-
query predicate localSuccessor(BasicBlock bb, string msg) {
325-
bb instanceof RelevantBasicBlock and
319+
query predicate localSuccessor(RelevantBasicBlock bb, string msg) {
326320
msg = "BasicBlock has non-local successor" and
327321
bb.getEnclosingCallable() != getABasicBlockSuccessor(bb).getEnclosingCallable()
328322
}
@@ -338,23 +332,17 @@ module Flow<InputSig Input> implements OutputSig<Input> {
338332
not captureAccess(v, _)
339333
}
340334

341-
query predicate uniqueLocation(Expr e, string msg) {
342-
e instanceof RelevantExpr and
343-
(
344-
msg = "Expr has no location" and not exists(e.getLocation())
345-
or
346-
msg = "Expr has multiple locations" and 2 <= strictcount(e.getLocation())
347-
)
335+
query predicate uniqueLocation(RelevantExpr e, string msg) {
336+
msg = "Expr has no location" and not exists(e.getLocation())
337+
or
338+
msg = "Expr has multiple locations" and 2 <= strictcount(e.getLocation())
348339
}
349340

350-
query predicate uniqueCfgNode(Expr e, string msg) {
351-
e instanceof RelevantExpr and
352-
(
353-
msg = "Expr has no cfg node" and not e.hasCfgNode(_, _)
354-
or
355-
msg = "Expr has multiple cfg nodes" and
356-
2 <= strictcount(BasicBlock bb, int i | e.hasCfgNode(bb, i))
357-
)
341+
query predicate uniqueCfgNode(RelevantExpr e, string msg) {
342+
msg = "Expr has no cfg node" and not e.hasCfgNode(_, _)
343+
or
344+
msg = "Expr has multiple cfg nodes" and
345+
2 <= strictcount(BasicBlock bb, int i | e.hasCfgNode(bb, i))
358346
}
359347

360348
private predicate uniqueWriteTarget(VariableWrite vw, string msg) {
@@ -429,13 +417,10 @@ module Flow<InputSig Input> implements OutputSig<Input> {
429417
)
430418
}
431419

432-
query predicate uniqueCallableLocation(Callable c, string msg) {
433-
c instanceof RelevantCallable and
434-
(
435-
msg = "Callable has no location" and not exists(c.getLocation())
436-
or
437-
msg = "Callable has multiple locations" and 2 <= strictcount(c.getLocation())
438-
)
420+
query predicate uniqueCallableLocation(RelevantCallable c, string msg) {
421+
msg = "Callable has no location" and not exists(c.getLocation())
422+
or
423+
msg = "Callable has multiple locations" and 2 <= strictcount(c.getLocation())
439424
}
440425

441426
query predicate consistencyOverview(string msg, int n) {

0 commit comments

Comments
 (0)