Skip to content

Commit 1cba09d

Browse files
committed
C++: Remove some remnants of the extractor CFG
1 parent f406072 commit 1cba09d

File tree

5 files changed

+14
-195
lines changed

5 files changed

+14
-195
lines changed

cpp/ql/src/semmle/code/cpp/controlflow/ControlFlowGraph.qll

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class ControlFlowNode extends Locatable, ControlFlowNodeBase {
6565
* taken when this expression is true.
6666
*/
6767
ControlFlowNode getATrueSuccessor() {
68-
truecond_base(this, result) and
68+
qlCFGTrueSuccessor(this, result) and
6969
result = getASuccessor()
7070
}
7171

@@ -74,7 +74,7 @@ class ControlFlowNode extends Locatable, ControlFlowNodeBase {
7474
* taken when this expression is false.
7575
*/
7676
ControlFlowNode getAFalseSuccessor() {
77-
falsecond_base(this, result) and
77+
qlCFGFalseSuccessor(this, result) and
7878
result = getASuccessor()
7979
}
8080

@@ -94,22 +94,6 @@ import ControlFlowGraphPublic
9494
*/
9595
class ControlFlowNodeBase extends ElementBase, @cfgnode { }
9696

97-
/**
98-
* Holds when `n2` is a control-flow node such that the control-flow
99-
* edge `(n1, n2)` may be taken when `n1` is an expression that is true.
100-
*/
101-
predicate truecond_base(ControlFlowNodeBase n1, ControlFlowNodeBase n2) {
102-
qlCFGTrueSuccessor(n1, n2)
103-
}
104-
105-
/**
106-
* Holds when `n2` is a control-flow node such that the control-flow
107-
* edge `(n1, n2)` may be taken when `n1` is an expression that is false.
108-
*/
109-
predicate falsecond_base(ControlFlowNodeBase n1, ControlFlowNodeBase n2) {
110-
qlCFGFalseSuccessor(n1, n2)
111-
}
112-
11397
/**
11498
* An abstract class that can be extended to add additional edges to the
11599
* control-flow graph. Instances of this class correspond to the source nodes
@@ -134,7 +118,7 @@ abstract class AdditionalControlFlowEdge extends ControlFlowNodeBase {
134118
/**
135119
* Holds if there is a control-flow edge from `source` to `target` in either
136120
* the extractor-generated control-flow graph or in a subclass of
137-
* `AdditionalControlFlowEdge`. Use this relation instead of `successors`.
121+
* `AdditionalControlFlowEdge`. Use this relation instead of `qlCFGSuccessor`.
138122
*/
139123
predicate successors_extended(ControlFlowNodeBase source, ControlFlowNodeBase target) {
140124
qlCFGSuccessor(source, target)

cpp/ql/src/semmle/code/cpp/controlflow/internal/CFG.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,8 +1376,6 @@ private module Cached {
13761376
/**
13771377
* Holds if `n2` is a successor of `n1` in the CFG. This includes also
13781378
* true-successors and false-successors.
1379-
*
1380-
* This corresponds to the old `successors` dbscheme relation.
13811379
*/
13821380
cached
13831381
predicate qlCFGSuccessor(Node n1, Node n2) {
@@ -1390,9 +1388,8 @@ private module Cached {
13901388
}
13911389

13921390
/**
1393-
* Holds if `n2` is a true-successor of `n1` in the CFG.
1394-
*
1395-
* This corresponds to the old `truecond` dbscheme relation.
1391+
* Holds if `n2` is a control-flow node such that the control-flow
1392+
* edge `(n1, n2)` may be taken when `n1` is an expression that is true.
13961393
*/
13971394
cached
13981395
predicate qlCFGTrueSuccessor(Node n1, Node n2) {
@@ -1401,9 +1398,8 @@ private module Cached {
14011398
}
14021399

14031400
/**
1404-
* Holds if `n2` is a false-successor of `n1` in the CFG.
1405-
*
1406-
* This corresponds to the old `falsecond` dbscheme relation.
1401+
* Holds if `n2` is a control-flow node such that the control-flow
1402+
* edge `(n1, n2)` may be taken when `n1` is an expression that is false.
14071403
*/
14081404
cached
14091405
predicate qlCFGFalseSuccessor(Node n1, Node n2) {

cpp/ql/src/semmle/code/cpp/controlflow/internal/ConstantExprs.qll

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import cpp
22
private import PrimitiveBasicBlocks
3+
private import semmle.code.cpp.controlflow.internal.CFG
34

45
private class Node = ControlFlowNodeBase;
56

@@ -153,17 +154,17 @@ private predicate nonAnalyzableFunction(Function f) {
153154
*/
154155
private predicate impossibleFalseEdge(Expr condition, Node succ) {
155156
conditionAlwaysTrue(condition) and
156-
falsecond_base(condition, succ) and
157-
not truecond_base(condition, succ)
157+
qlCFGFalseSuccessor(condition, succ) and
158+
not qlCFGTrueSuccessor(condition, succ)
158159
}
159160

160161
/**
161162
* If a condition is provably false, then control-flow edges to its true successors are impossible.
162163
*/
163164
private predicate impossibleTrueEdge(Expr condition, Node succ) {
164165
conditionAlwaysFalse(condition) and
165-
truecond_base(condition, succ) and
166-
not falsecond_base(condition, succ)
166+
qlCFGTrueSuccessor(condition, succ) and
167+
not qlCFGFalseSuccessor(condition, succ)
167168
}
168169

169170
/**
@@ -863,9 +864,9 @@ library class ConditionEvaluator extends ExprEvaluator {
863864
ConditionEvaluator() { this = 0 }
864865

865866
override predicate interesting(Expr e) {
866-
falsecond_base(e, _)
867+
qlCFGFalseSuccessor(e, _)
867868
or
868-
truecond_base(e, _)
869+
qlCFGTrueSuccessor(e, _)
869870
}
870871
}
871872

cpp/ql/src/semmlecode.cpp.dbscheme

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,20 +1935,6 @@ stmtparents(
19351935
ishandler(unique int block: @stmt_block ref);
19361936

19371937
@cfgnode = @stmt | @expr | @function | @initialiser ;
1938-
successors(
1939-
int from: @cfgnode ref,
1940-
int to: @cfgnode ref
1941-
);
1942-
1943-
truecond(
1944-
unique int from: @cfgnode ref,
1945-
int to: @cfgnode ref
1946-
);
1947-
1948-
falsecond(
1949-
unique int from: @cfgnode ref,
1950-
int to: @cfgnode ref
1951-
);
19521938

19531939
stmt_decl_bind(
19541940
int stmt: @stmt_decl ref,

cpp/ql/test/library-tests/syntax-zoo/Compare.qll

Lines changed: 0 additions & 148 deletions
This file was deleted.

0 commit comments

Comments
 (0)