File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
java/ql/lib/semmle/code/java Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ private import Completion
8484private import controlflow.internal.Preconditions
8585private import controlflow.internal.SwitchCases
8686
87+ /** Provides the definition of control flow nodes. */
8788module ControlFlow {
8889 private predicate hasControlFlow ( Expr e ) {
8990 not exists ( ConstCase cc | e = cc .getValue ( _) ) and
@@ -155,19 +156,27 @@ module ControlFlow {
155156 result = "Exit" and this instanceof ExitNode
156157 }
157158
159+ /** Gets the source location for this element. */
158160 Location getLocation ( ) {
159161 result = this .asExpr ( ) .getLocation ( ) or
160162 result = this .asStmt ( ) .getLocation ( ) or
161163 result = this .( ExitNode ) .getEnclosingCallable ( ) .getLocation ( )
162164 }
163165
166+ /**
167+ * Get the most appropriate AST node for this control flow node, if any.
168+ *
169+ * This is needed for the equivalence relation on basic blocks in range
170+ * analysis.
171+ */
164172 ExprParent getAstNode ( ) {
165173 result = this .asExpr ( ) or
166174 result = this .asStmt ( ) or
167175 this = TExitNode ( result )
168176 }
169177 }
170178
179+ /** A synthetic node for the exit of a callable. */
171180 class ExitNode extends Node , TExitNode { }
172181}
173182
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ class BasicBlock extends ControlFlowNode {
6767 predicate bbPostDominates ( BasicBlock node ) { bbPostDominates ( this , node ) }
6868}
6969
70+ /** A basic block that ends in an exit node. */
7071class ExitBlock extends BasicBlock {
7172 ExitBlock ( ) { this .getLastNode ( ) instanceof ControlFlow:: ExitNode }
7273}
You can’t perform that action at this time.
0 commit comments