Skip to content

Commit 274281f

Browse files
owen-mcaschackmull
andcommitted
Apply all suggestions from code review
Co-authored-by: Anders Schack-Mulligen <[email protected]>
1 parent d06dfe0 commit 274281f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

java/ql/lib/semmle/code/java/ControlFlowGraph.qll

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Provides classes and predicates for computing expression-level intra-procedural control flow graphs.
33
*
4-
* The only API exported by this library are the toplevel classes `ControlFlowNode`
4+
* The only API exported by this library are the toplevel classes `ControlFlow::Node`
55
* and its subclass `ConditionNode`, which wrap the successor relation and the
66
* concept of true- and false-successors of conditions. A cfg node may either be a
77
* statement, an expression, or an exit node for a callable, indicating that
@@ -164,7 +164,7 @@ module ControlFlow {
164164
}
165165

166166
/**
167-
* Get the most appropriate AST node for this control flow node, if any.
167+
* Gets the most appropriate AST node for this control flow node, if any.
168168
*
169169
* This is needed for the equivalence relation on basic blocks in range
170170
* analysis.
@@ -176,7 +176,7 @@ module ControlFlow {
176176
}
177177
}
178178

179-
/** A synthetic node for the exit of a callable. */
179+
/** A control flow node indicating the termination of a callable. */
180180
class ExitNode extends Node, TExitNode { }
181181
}
182182

@@ -197,7 +197,7 @@ private module ControlFlowGraphImpl {
197197
result = this.(Expr).getEnclosingStmt()
198198
}
199199

200-
Node getCFGNode() { result.asExpr() = this or result.asStmt() = this }
200+
Node getCfgNode() { result.asExpr() = this or result.asStmt() = this }
201201
}
202202

203203
/**
@@ -931,7 +931,6 @@ private module ControlFlowGraphImpl {
931931
)
932932
or
933933
// The last node of a node executed in post-order is the node itself.
934-
// n.(PostOrderNode).mayCompleteNormally() and last = n and completion = NormalCompletion()
935934
exists(PostOrderNode p | p = n |
936935
p.mayCompleteNormally() and last = p.getCFGNode() and completion = NormalCompletion()
937936
)
@@ -1195,7 +1194,7 @@ private module ControlFlowGraphImpl {
11951194
*/
11961195
cached
11971196
Node succ(Node n, Completion completion) {
1198-
// The successor of a callable is its exit node.
1197+
// After executing the callable body, the final node is the exit node.
11991198
exists(Callable c | last(c.getBody(), n, completion) |
12001199
result.(ExitNode).getEnclosingCallable() = c
12011200
)
@@ -1404,7 +1403,7 @@ private module ControlFlowGraphImpl {
14041403
switchExpr = switch.(SwitchStmt).getExpr() or switchExpr = switch.(SwitchExpr).getExpr()
14051404
|
14061405
// From the entry point control is transferred first to the expression...
1407-
(n.asStmt() = switch or n.asExpr() = switch) and
1406+
n.getAstNode() = switch and
14081407
result = first(switchExpr) and
14091408
completion = NormalCompletion()
14101409
or
@@ -1601,6 +1600,6 @@ class ConditionNode extends ControlFlow::Node {
16011600
/** Gets a false-successor of the `ConditionNode`. */
16021601
ControlFlow::Node getAFalseSuccessor() { result = this.getABranchSuccessor(false) }
16031602

1604-
/** Gets the condition of this `ConditionNode`. This is equal to the node itself. */
1603+
/** Gets the condition of this `ConditionNode`. */
16051604
ExprParent getCondition() { result = this.asExpr() or result = this.asStmt() }
16061605
}

0 commit comments

Comments
 (0)