Skip to content

Commit a6b3310

Browse files
committed
C++: test new class LeaveStmt
1 parent f6fa707 commit a6b3310

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//semmle-extractor-options: --microsoft
2+
void leave_try_finally_test(bool condition){
3+
__try {
4+
if(condition){
5+
__leave;
6+
}
7+
}
8+
__finally {
9+
}
10+
}
11+
12+
int except_handler();
13+
14+
void leave_try_except_test(bool condition){
15+
__try {
16+
try {
17+
if(condition)
18+
__leave;
19+
}
20+
catch(...) {
21+
}
22+
if(condition){
23+
__leave;
24+
}
25+
}
26+
__except (except_handler()) {
27+
}
28+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| leave.cpp:5:8:5:15 | __leave; | leave.cpp:3:5:7:5 | __try { ... } __finally { ... } |
2+
| leave.cpp:18:17:18:24 | __leave; | leave.cpp:15:5:25:5 | __try { ... } __except( ... ) { ... } |
3+
| leave.cpp:23:13:23:20 | __leave; | leave.cpp:15:5:25:5 | __try { ... } __except( ... ) { ... } |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
3+
from LeaveStmt s
4+
select s, s.getEnclosingTry()

0 commit comments

Comments
 (0)