Java: Adjust BasicBlock-based qltests.

This commit is contained in:
Anders Schack-Mulligen
2026-02-10 14:33:50 +01:00
parent 7871cd74f6
commit 12b9999289
10 changed files with 58 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
import java
import semmle.code.java.controlflow.Dominance
import utils.test.BasicBlock
from BasicBlock b, BasicBlock b2
where b.strictlyDominates(b2)
select b, b2
select getFirstAstNode(b), getFirstAstNode(b2)

View File

@@ -1,5 +1,6 @@
import java
import utils.test.BasicBlock
from BasicBlock b, BasicBlock b2
where b.getASuccessor() = b2
select b, b2
select getFirstAstNodeOrSynth(b), getFirstAstNodeOrSynth(b2)

View File

@@ -1,8 +1,9 @@
import java
import semmle.code.java.controlflow.Guards
import utils.test.BasicBlock
from ConditionBlock cb, boolean testIsTrue, BasicBlock controlled
where
cb.controls(controlled, testIsTrue) and
cb.getEnclosingCallable().getDeclaringType().hasName("Test")
select cb.getCondition(), testIsTrue, controlled
select cb.getCondition(), testIsTrue, getFirstAstNode(controlled)

View File

@@ -1,9 +1,10 @@
import java
import semmle.code.java.controlflow.Guards
import utils.test.BasicBlock
from Guard g, BasicBlock bb, GuardValue gv
where
g.valueControls(bb, gv) and
g.getEnclosingCallable().getDeclaringType().hasName("Logic") and
(exists(gv.asBooleanValue()) or gv.isThrowsException() or gv.getDualValue().isThrowsException())
select g, gv, bb
select g, gv, getFirstAstNode(bb)

View File

@@ -1,9 +1,10 @@
import java
import semmle.code.java.controlflow.Guards
import utils.test.BasicBlock
from Guard g, BasicBlock bb, GuardValue gv
where
g.valueControls(bb, gv) and
g.getEnclosingCallable().getDeclaringType().hasName("Preconditions") and
(gv.isThrowsException() or gv.getDualValue().isThrowsException())
select g, gv, bb
select g, gv, getFirstAstNode(bb)