Skip to content

Commit ef37893

Browse files
committed
CPP: Improve the MemberFunctions test.
1 parent 843b85c commit ef37893

File tree

2 files changed

+56
-30
lines changed

2 files changed

+56
-30
lines changed
Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
| ODASA-5186.cpp:4:8:4:14 | MyClass<T> | Class | ODASA-5186.cpp:5:8:5:17 | operator== | member function |
2-
| ODASA-5186.cpp:4:8:4:14 | MyClass<int> | Struct | ODASA-5186.cpp:4:8:4:8 | operator= | member function |
3-
| ODASA-5186.cpp:4:8:4:14 | MyClass<int> | Struct | ODASA-5186.cpp:4:8:4:8 | operator= | member function |
4-
| ODASA-5186.cpp:4:8:4:14 | MyClass<int> | Struct | ODASA-5186.cpp:5:8:5:8 | operator== | member function |
5-
| ODASA-5186.hpp:2:8:2:17 | NEQ_helper<MyClass<int>> | Struct | ODASA-5186.hpp:2:8:2:8 | operator= | member function |
6-
| ODASA-5186.hpp:2:8:2:17 | NEQ_helper<MyClass<int>> | Struct | ODASA-5186.hpp:2:8:2:8 | operator= | member function |
7-
| file://:0:0:0:0 | __va_list_tag | Struct | file://:0:0:0:0 | operator= | member function |
8-
| file://:0:0:0:0 | __va_list_tag | Struct | file://:0:0:0:0 | operator= | member function |
9-
| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:7:8:7:8 | operator= | member function |
10-
| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:7:8:7:8 | operator= | member function |
11-
| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:8:7:8:8 | af | member function |
12-
| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:11:7:11:8 | ag | member function |
13-
| functions.cpp:19:7:19:10 | Name | Class | functions.cpp:19:7:19:7 | operator= | member function |
14-
| functions.cpp:19:7:19:10 | Name | Class | functions.cpp:19:7:19:7 | operator= | member function |
15-
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | Table | constructor |
16-
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | Table | member function |
17-
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | operator= | member function |
18-
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:27:3:27:7 | Table | constructor |
19-
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:27:3:27:7 | Table | member function |
20-
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:28:3:28:8 | ~Table | destructor |
21-
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:28:3:28:8 | ~Table | member function |
22-
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:29:9:29:14 | lookup | member function |
23-
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:30:8:30:13 | insert | member function |
1+
| ODASA-5186.cpp:4:8:4:14 | MyClass<T> | Class | ODASA-5186.cpp:5:8:5:17 | operator== | |
2+
| ODASA-5186.cpp:4:8:4:14 | MyClass<int> | Struct | ODASA-5186.cpp:4:8:4:8 | operator= | |
3+
| ODASA-5186.cpp:4:8:4:14 | MyClass<int> | Struct | ODASA-5186.cpp:4:8:4:8 | operator= | |
4+
| ODASA-5186.cpp:4:8:4:14 | MyClass<int> | Struct | ODASA-5186.cpp:5:8:5:8 | operator== | |
5+
| ODASA-5186.hpp:2:8:2:17 | NEQ_helper<MyClass<int>> | Struct | ODASA-5186.hpp:2:8:2:8 | operator= | |
6+
| ODASA-5186.hpp:2:8:2:17 | NEQ_helper<MyClass<int>> | Struct | ODASA-5186.hpp:2:8:2:8 | operator= | |
7+
| file://:0:0:0:0 | __va_list_tag | Struct | file://:0:0:0:0 | operator= | |
8+
| file://:0:0:0:0 | __va_list_tag | Struct | file://:0:0:0:0 | operator= | |
9+
| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:7:8:7:8 | operator= | |
10+
| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:7:8:7:8 | operator= | |
11+
| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:8:7:8:8 | af | |
12+
| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:11:7:11:8 | ag | |
13+
| functions.cpp:19:7:19:10 | Name | Class | functions.cpp:19:7:19:7 | operator= | |
14+
| functions.cpp:19:7:19:10 | Name | Class | functions.cpp:19:7:19:7 | operator= | |
15+
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | Table | Constructor, CopyConstructor, getAConstructor() |
16+
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | operator= | |
17+
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:27:3:27:7 | Table | Constructor, getAConstructor() |
18+
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:28:3:28:8 | ~Table | Destructor, getDestructor() |
19+
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:29:9:29:14 | lookup | |
20+
| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:30:8:30:13 | insert | |

cpp/ql/test/library-tests/functions/functions/Functions2.ql

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,41 @@
44
*/
55
import cpp
66

7-
from Class c, string ctype, MemberFunction f, string ftype
8-
where
9-
if c instanceof Struct then ctype = "Struct" else ctype = "Class" and
7+
bindingset[c, f] string describe(Class c, MemberFunction f)
8+
{
109
(
11-
(f = c.getAConstructor() and ftype = "constructor") or
12-
(f = c.getDestructor() and ftype = "destructor") or
13-
(f.getDeclaringType() = c and ftype = "member function")
10+
f = c.getAConstructor() and
11+
result = "getAConstructor()"
12+
) or (
13+
f = c.getDestructor() and
14+
result = "getDestructor()"
15+
) or (
16+
f instanceof Constructor and
17+
result = "Constructor"
18+
) or (
19+
f instanceof Destructor and
20+
result = "Destructor"
21+
) or (
22+
f instanceof ConversionConstructor and
23+
result = "ConversionConstructor"
24+
) or (
25+
f instanceof CopyConstructor and
26+
result = "CopyConstructor"
27+
) or (
28+
f instanceof MoveConstructor and
29+
result = "MoveConstructor"
30+
) or (
31+
f instanceof NoArgConstructor and
32+
result = "NoArgConstructor"
33+
) or (
34+
f instanceof ConversionOperator and
35+
result = "ConversionOperator"
1436
)
15-
select c, ctype, f, ftype
37+
}
38+
39+
from Class c, string ctype, MemberFunction f
40+
where
41+
f.getDeclaringType() = c and
42+
if c instanceof Struct then ctype = "Struct" else ctype = "Class"
43+
select
44+
c, ctype, f, concat(describe(c, f), ", ")

0 commit comments

Comments
 (0)