From 10efea10758f3f67db60b2195c35af0b000098e0 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Tue, 20 May 2025 14:30:40 +0200 Subject: [PATCH] Java/Shared: Address review comments. --- java/ql/lib/change-notes/2025-05-16-shared-basicblocks.md | 2 +- java/ql/lib/semmle/code/java/controlflow/BasicBlocks.qll | 6 ++---- shared/controlflow/codeql/controlflow/BasicBlock.qll | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/java/ql/lib/change-notes/2025-05-16-shared-basicblocks.md b/java/ql/lib/change-notes/2025-05-16-shared-basicblocks.md index ff8be9b9edd..e71ae5c1317 100644 --- a/java/ql/lib/change-notes/2025-05-16-shared-basicblocks.md +++ b/java/ql/lib/change-notes/2025-05-16-shared-basicblocks.md @@ -1,4 +1,4 @@ --- category: deprecated --- -* Java now uses the shared `BasicBlock` library. This means that several member predicates now use the preferred names. The old predicates have been deprecated. The `BasicBlock` class itself no longer extends `ControlFlowNode` - the predicate `getFirstNode` can be used to fix any QL code that somehow relied on this. +* Java now uses the shared `BasicBlock` library. This means that the names of several member predicates have been changed to align with the names used in other languages. The old predicates have been deprecated. The `BasicBlock` class itself no longer extends `ControlFlowNode` - the predicate `getFirstNode` can be used to fix any QL code that somehow relied on this. diff --git a/java/ql/lib/semmle/code/java/controlflow/BasicBlocks.qll b/java/ql/lib/semmle/code/java/controlflow/BasicBlocks.qll index e8395166d4e..284ee1dad0c 100644 --- a/java/ql/lib/semmle/code/java/controlflow/BasicBlocks.qll +++ b/java/ql/lib/semmle/code/java/controlflow/BasicBlocks.qll @@ -70,10 +70,8 @@ predicate hasDominanceInformation(BasicBlock bb) { } /** - * A control-flow node that represents the start of a basic block. - * - * A basic block is a series of nodes with no control-flow branching, which can - * often be treated as a unit in analyses. + * A basic block, that is, a maximal straight-line sequence of control flow nodes + * without branches or joins. */ class BasicBlock extends BbImpl::BasicBlock { /** Gets the immediately enclosing callable whose body contains this node. */ diff --git a/shared/controlflow/codeql/controlflow/BasicBlock.qll b/shared/controlflow/codeql/controlflow/BasicBlock.qll index d5cda7b910b..9c26b18c093 100644 --- a/shared/controlflow/codeql/controlflow/BasicBlock.qll +++ b/shared/controlflow/codeql/controlflow/BasicBlock.qll @@ -246,9 +246,9 @@ module Make Input> { * implies that `(bb1, bb2)` dominates its endpoint `bb2`. I.e., `bb2` can * only be reached from the entry block by going via `(bb1, bb2)`. * - * This is a necessary and sufficient condition for an edge to dominate anything, - * and in particular `dominatingEdge(bb1, bb2) and bb2.dominates(bb3)` means - * that the edge `(bb1, bb2)` dominates `bb3`. + * This is a necessary and sufficient condition for an edge to dominate some + * block, and therefore `dominatingEdge(bb1, bb2) and bb2.dominates(bb3)` + * means that the edge `(bb1, bb2)` dominates `bb3`. */ pragma[nomagic] predicate dominatingEdge(BasicBlock bb1, BasicBlock bb2) {