File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
cpp/ql/src/semmle/code/cpp/controlflow/internal Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,11 @@ private cached module Cached {
3131 // or the node's predecessor has more than one successor,
3232 // then the node is the start of a new primitive basic block.
3333 or
34- strictcount ( Node pred , Node other
35- | successors_extended ( pred , node ) and successors_extended ( pred , other ) ) > 1
34+ strictcount ( Node pred | successors_extended ( pred , node ) ) > 1
35+ or
36+ exists ( ControlFlowNode pred | successors_extended ( pred , node ) |
37+ strictcount ( ControlFlowNode other | successors_extended ( pred , other ) ) > 1
38+ )
3639
3740 // If the node has zero predecessors then it is the start of
3841 // a BB. However, the C++ AST contains many nodes with zero
@@ -63,8 +66,14 @@ private cached module Cached {
6366 /** Holds if `node` is the `pos`th control-flow node in primitive basic block `bb`. */
6467 cached
6568 predicate primitive_basic_block_member ( Node node , PrimitiveBasicBlock bb , int pos ) {
66- pos = getMemberIndex ( node ) and
67- member_step * ( bb , node )
69+ primitive_basic_block_entry_node ( bb ) and
70+ (
71+ pos = 0 and
72+ node = bb
73+ or
74+ pos = getMemberIndex ( node ) and
75+ member_step + ( bb , node )
76+ )
6877 }
6978
7079 /** Gets the number of control-flow nodes in the primitive basic block `bb`. */
You can’t perform that action at this time.
0 commit comments