Skip to content

Commit fb21815

Browse files
committed
C++: Change the testcase so that it outputs the controlling values for switch statements as well.
1 parent 07ebbb0 commit fb21815

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,7 @@
8686
| test.cpp:31:7:31:13 | ... == ... | true | 31 | 32 |
8787
| test.cpp:42:13:42:20 | call to getABool | false | 53 | 53 |
8888
| test.cpp:42:13:42:20 | call to getABool | true | 43 | 45 |
89+
| test.cpp:61:10:61:10 | i | Case[0] | 62 | 64 |
90+
| test.cpp:61:10:61:10 | i | Case[1] | 65 | 66 |
91+
| test.cpp:74:10:74:10 | i | Case[0..10] | 75 | 77 |
92+
| test.cpp:74:10:74:10 | i | Case[11..20] | 78 | 79 |

cpp/ql/test/library-tests/controlflow/guards/GuardsControl.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
import cpp
88
import semmle.code.cpp.controlflow.Guards
99

10-
from GuardCondition guard, boolean sense, int start, int end
10+
from GuardCondition guard, AbstractValue value, int start, int end
1111
where
1212
exists(BasicBlock block |
13-
guard.controls(block, sense) and
13+
guard.valueControls(block, value) and
1414
block.hasLocationInfo(_, start, _, end, _)
1515
)
16-
select guard, sense, start, end
16+
select guard, value, start, end

0 commit comments

Comments
 (0)