Skip to content

Commit f8655b1

Browse files
committed
CPP: Add a test that uses Function.getAThrownType() and Function.isNoThrow().
1 parent e237507 commit f8655b1

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
| test.cpp:2:6:2:10 | func1 | | isNoExcept |
2+
| test.cpp:3:6:3:10 | func2 | | |
3+
| test.cpp:4:6:4:10 | func3 | | |
4+
| test.cpp:5:6:5:10 | func4 | | |
5+
| test.cpp:6:6:6:10 | func5 | | |
6+
| test.cpp:8:6:8:10 | func6 | | isNoThrow |
7+
| test.cpp:9:6:9:10 | func7 | int | |
8+
| test.cpp:11:6:11:10 | func8 | char, int | |
9+
| test.cpp:15:7:15:7 | operator= | | isNoThrow |
10+
| test.cpp:15:7:15:7 | operator= | | isNoThrow |
11+
| test.cpp:17:7:17:11 | func9 | | isNoThrow |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import cpp
2+
3+
string describe(Function f) {
4+
(
5+
f.isNoThrow() and
6+
result = "isNoThrow"
7+
) or (
8+
f.isNoExcept() and
9+
result = "isNoExcept"
10+
)
11+
}
12+
13+
from Function f
14+
where exists(f.getFile())
15+
select f, concat(f.getAThrownType().toString(), ", "), concat(describe(f), ", ")
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
void func1() noexcept;
3+
void func2() noexcept(true);
4+
void func3() noexcept(false);
5+
void func4() noexcept(func1);
6+
void func5(void param() noexcept);
7+
8+
void func6() throw();
9+
void func7() throw(int);
10+
void func8() throw(char, int);
11+
void func8() throw(char, int)
12+
{
13+
}
14+
15+
class c
16+
{
17+
void func9() throw();
18+
};

0 commit comments

Comments
 (0)