File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
cpp/ql/src/semmle/code/cpp/dataflow/internal Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -97,16 +97,24 @@ class SubBasicBlock extends ControlFlowNodeBase {
9797 * start from 0, and the node at position 0 always exists and compares equal
9898 * to `this`.
9999 */
100+ pragma [ nomagic]
100101 ControlFlowNode getNode ( int pos ) {
101- exists ( BasicBlock bb | bb = this .getBasicBlock ( ) |
102- exists ( int thisPos | this = bb .getNode ( thisPos ) |
103- result = bb .getNode ( thisPos + pos ) and
104- pos >= 0 and
105- pos < this .getNumberOfNodes ( )
102+ exists ( BasicBlock bb |
103+ exists ( int outerPos |
104+ result = bb .getNode ( outerPos ) and
105+ pos = outerPosToInnerPos ( bb , outerPos )
106106 )
107107 )
108108 }
109109
110+ pragma [ nomagic]
111+ private int outerPosToInnerPos ( BasicBlock bb , int posInBB ) {
112+ exists ( int thisPosInBB | this = bb .getNode ( thisPosInBB ) |
113+ posInBB = result + thisPosInBB and
114+ result = [ 0 .. this .getNumberOfNodes ( ) - 1 ]
115+ )
116+ }
117+
110118 /** Gets a control-flow node in this `SubBasicBlock`. */
111119 ControlFlowNode getANode ( ) {
112120 result = this .getNode ( _)
You can’t perform that action at this time.
0 commit comments