|
1 | 1 | import cpp |
2 | | -import semmle.code.cpp.controlflow.LocalScopeVariableReachability |
| 2 | +import semmle.code.cpp.controlflow.StackVariableReachability |
3 | 3 |
|
4 | | -// Test that def/use algorithm is an instance of LocalScopeVariableReachability |
5 | | -class MyDefOrUse extends LocalScopeVariableReachability { |
| 4 | +// Test that def/use algorithm is an instance of StackVariableReachability |
| 5 | +class MyDefOrUse extends StackVariableReachability { |
6 | 6 | MyDefOrUse() { this = "MyDefUse" } |
7 | 7 |
|
8 | | - override predicate isSource(ControlFlowNode node, LocalScopeVariable v) { definition(v, node) } |
| 8 | + override predicate isSource(ControlFlowNode node, StackVariable v) { definition(v, node) } |
9 | 9 |
|
10 | | - override predicate isSink(ControlFlowNode node, LocalScopeVariable v) { useOfVar(v, node) } |
| 10 | + override predicate isSink(ControlFlowNode node, StackVariable v) { useOfVar(v, node) } |
11 | 11 |
|
12 | | - override predicate isBarrier(ControlFlowNode node, LocalScopeVariable v) { |
13 | | - definitionBarrier(v, node) |
14 | | - } |
| 12 | + override predicate isBarrier(ControlFlowNode node, StackVariable v) { definitionBarrier(v, node) } |
15 | 13 | } |
16 | 14 |
|
17 | 15 | predicate equivalence() { |
18 | | - forall(LocalScopeVariable v, Expr first, Expr second | definitionUsePair(v, first, second) | |
| 16 | + forall(StackVariable v, Expr first, Expr second | definitionUsePair(v, first, second) | |
19 | 17 | exists(MyDefOrUse x | x.reaches(first, v, second)) |
20 | 18 | ) and |
21 | | - forall(LocalScopeVariable v, Expr first, Expr second | |
| 19 | + forall(StackVariable v, Expr first, Expr second | |
22 | 20 | exists(MyDefOrUse x | x.reaches(first, v, second)) |
23 | 21 | | |
24 | 22 | definitionUsePair(v, first, second) |
|
0 commit comments