File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
cpp/ql/src/semmle/code/cpp/dataflow/internal Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -75,13 +75,18 @@ class SubBasicBlock extends ControlFlowNodeBase {
7575 * `bb`, where `bb` is equal to `getBasicBlock()`.
7676 */
7777 int getPosInBasicBlock ( BasicBlock bb ) {
78- exists ( int nodePos , int rnk |
79- this = bb . getNode ( nodePos ) and
80- nodePos = rank [ rnk ] ( int i | exists ( SubBasicBlock n | n = bb . getNode ( i ) ) ) and
78+ exists ( int thisIndexInBB , int rnk |
79+ thisIndexInBB = this . getIndexInBasicBlock ( bb ) and
80+ thisIndexInBB = rank [ rnk ] ( int i | i = any ( SubBasicBlock n ) . getIndexInBasicBlock ( bb ) ) and
8181 result = rnk - 1
8282 )
8383 }
8484
85+ pragma [ noinline]
86+ private int getIndexInBasicBlock ( BasicBlock bb ) {
87+ this = bb .getNode ( result )
88+ }
89+
8590 /** Gets a successor in the control-flow graph of `SubBasicBlock`s. */
8691 SubBasicBlock getASuccessor ( ) {
8792 this .lastInBB ( ) and
@@ -109,10 +114,8 @@ class SubBasicBlock extends ControlFlowNodeBase {
109114
110115 pragma [ nomagic]
111116 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- )
117+ posInBB = result + this .getIndexInBasicBlock ( bb ) and
118+ result = [ 0 .. this .getNumberOfNodes ( ) - 1 ]
116119 }
117120
118121 /** Gets a control-flow node in this `SubBasicBlock`. */
You can’t perform that action at this time.
0 commit comments