Skip to content

Commit eebaf0f

Browse files
committed
C++: Modify the tests so that ConversionConstructors are tested; we don't want the general case for Constructors any more.
1 parent 33fab08 commit eebaf0f

File tree

7 files changed

+224
-207
lines changed

7 files changed

+224
-207
lines changed

cpp/ql/test/library-tests/dataflow/taint-tests/copyableclass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ void sink(...) {};
44

55
class MyCopyableClass {
66
public:
7-
MyCopyableClass(int _v = 0) : v(_v) {} // Constructor
7+
MyCopyableClass() {} // Constructor
8+
MyCopyableClass(int _v) : v(_v) {} // ConversionConstructor
89
MyCopyableClass(const MyCopyableClass &other) : v(other.v) {} // CopyConstructor
910
MyCopyableClass &operator=(const MyCopyableClass &other) { // CopyAssignmentOperator
1011
v = other.v;

cpp/ql/test/library-tests/dataflow/taint-tests/localTaint.expected

Lines changed: 176 additions & 162 deletions
Large diffs are not rendered by default.

cpp/ql/test/library-tests/dataflow/taint-tests/movableclass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ void sink(...) {};
44

55
class MyMovableClass {
66
public:
7-
MyMovableClass(int _v = 0) : v(_v) {} // Constructor
7+
MyMovableClass() {} // Constructor
8+
MyMovableClass(int _v) : v(_v) {} // ConversionConstructor
89
MyMovableClass(MyMovableClass &&other) noexcept { // ConversionConstructor, MoveConstructor
910
v = other.v;
1011
other.v = 0;

cpp/ql/test/library-tests/dataflow/taint-tests/structlikeclass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ void sink(...) {};
44

55
class StructLikeClass {
66
public:
7-
StructLikeClass(int _v = 0) : v(_v) {} // Constructor
7+
StructLikeClass() {} // Constructor
8+
StructLikeClass(int _v) : v(_v) {} // ConversionConstructor
89

910
int v;
1011
};

cpp/ql/test/library-tests/dataflow/taint-tests/taint.expected

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
| copyableclass.cpp:39:8:39:9 | s1 | copyableclass.cpp:33:22:33:27 | call to source |
2-
| copyableclass.cpp:40:8:40:9 | s2 | copyableclass.cpp:34:24:34:29 | call to source |
3-
| copyableclass.cpp:41:8:41:9 | s3 | copyableclass.cpp:33:22:33:27 | call to source |
4-
| copyableclass.cpp:42:8:42:9 | s4 | copyableclass.cpp:37:8:37:13 | call to source |
5-
| copyableclass.cpp:64:8:64:9 | s1 | copyableclass.cpp:59:40:59:45 | call to source |
6-
| copyableclass.cpp:65:8:65:9 | s2 | copyableclass.cpp:62:24:62:29 | call to source |
7-
| copyableclass.cpp:66:11:66:11 | call to operator= | copyableclass.cpp:66:13:66:18 | call to source |
1+
| copyableclass.cpp:40:8:40:9 | s1 | copyableclass.cpp:34:22:34:27 | call to source |
2+
| copyableclass.cpp:41:8:41:9 | s2 | copyableclass.cpp:35:24:35:29 | call to source |
3+
| copyableclass.cpp:42:8:42:9 | s3 | copyableclass.cpp:34:22:34:27 | call to source |
4+
| copyableclass.cpp:43:8:43:9 | s4 | copyableclass.cpp:38:8:38:13 | call to source |
5+
| copyableclass.cpp:65:8:65:9 | s1 | copyableclass.cpp:60:40:60:45 | call to source |
6+
| copyableclass.cpp:66:8:66:9 | s2 | copyableclass.cpp:63:24:63:29 | call to source |
7+
| copyableclass.cpp:67:11:67:11 | call to operator= | copyableclass.cpp:67:13:67:18 | call to source |
88
| format.cpp:57:8:57:13 | buffer | format.cpp:56:36:56:49 | call to source |
99
| format.cpp:62:8:62:13 | buffer | format.cpp:61:30:61:43 | call to source |
1010
| format.cpp:67:8:67:13 | buffer | format.cpp:66:52:66:65 | call to source |
@@ -17,13 +17,13 @@
1717
| format.cpp:110:8:110:14 | wbuffer | format.cpp:109:38:109:52 | call to source |
1818
| format.cpp:157:7:157:22 | access to array | format.cpp:147:12:147:25 | call to source |
1919
| format.cpp:158:7:158:27 | ... + ... | format.cpp:148:16:148:30 | call to source |
20-
| movableclass.cpp:43:8:43:9 | s1 | movableclass.cpp:38:21:38:26 | call to source |
21-
| movableclass.cpp:44:8:44:9 | s2 | movableclass.cpp:39:23:39:28 | call to source |
22-
| movableclass.cpp:45:8:45:9 | s3 | movableclass.cpp:41:8:41:13 | call to source |
23-
| movableclass.cpp:53:8:53:9 | s1 | movableclass.cpp:49:38:49:43 | call to source |
24-
| movableclass.cpp:54:8:54:9 | s2 | movableclass.cpp:51:23:51:28 | call to source |
25-
| movableclass.cpp:63:8:63:9 | s2 | movableclass.cpp:22:55:22:60 | call to source |
26-
| movableclass.cpp:64:11:64:11 | call to operator= | movableclass.cpp:64:13:64:18 | call to source |
20+
| movableclass.cpp:44:8:44:9 | s1 | movableclass.cpp:39:21:39:26 | call to source |
21+
| movableclass.cpp:45:8:45:9 | s2 | movableclass.cpp:40:23:40:28 | call to source |
22+
| movableclass.cpp:46:8:46:9 | s3 | movableclass.cpp:42:8:42:13 | call to source |
23+
| movableclass.cpp:54:8:54:9 | s1 | movableclass.cpp:50:38:50:43 | call to source |
24+
| movableclass.cpp:55:8:55:9 | s2 | movableclass.cpp:52:23:52:28 | call to source |
25+
| movableclass.cpp:64:8:64:9 | s2 | movableclass.cpp:23:55:23:60 | call to source |
26+
| movableclass.cpp:65:11:65:11 | call to operator= | movableclass.cpp:65:13:65:18 | call to source |
2727
| stl.cpp:71:7:71:7 | a | stl.cpp:67:12:67:17 | call to source |
2828
| stl.cpp:73:7:73:7 | c | stl.cpp:69:16:69:21 | call to source |
2929
| stl.cpp:75:9:75:13 | call to c_str | stl.cpp:69:16:69:21 | call to source |
@@ -35,13 +35,13 @@
3535
| stl.cpp:156:8:156:9 | s3 | stl.cpp:152:8:152:13 | call to source |
3636
| stl.cpp:175:8:175:9 | s1 | stl.cpp:171:32:171:37 | call to source |
3737
| stl.cpp:176:8:176:9 | s2 | stl.cpp:173:20:173:25 | call to source |
38-
| structlikeclass.cpp:34:8:34:9 | s1 | structlikeclass.cpp:28:22:28:27 | call to source |
39-
| structlikeclass.cpp:35:8:35:9 | s2 | structlikeclass.cpp:29:24:29:29 | call to source |
40-
| structlikeclass.cpp:36:8:36:9 | s3 | structlikeclass.cpp:28:22:28:27 | call to source |
41-
| structlikeclass.cpp:37:8:37:9 | s4 | structlikeclass.cpp:32:8:32:13 | call to source |
42-
| structlikeclass.cpp:59:8:59:9 | s1 | structlikeclass.cpp:54:40:54:45 | call to source |
43-
| structlikeclass.cpp:60:8:60:9 | s2 | structlikeclass.cpp:57:24:57:29 | call to source |
44-
| structlikeclass.cpp:61:8:61:20 | ... = ... | structlikeclass.cpp:61:13:61:18 | call to source |
38+
| structlikeclass.cpp:35:8:35:9 | s1 | structlikeclass.cpp:29:22:29:27 | call to source |
39+
| structlikeclass.cpp:36:8:36:9 | s2 | structlikeclass.cpp:30:24:30:29 | call to source |
40+
| structlikeclass.cpp:37:8:37:9 | s3 | structlikeclass.cpp:29:22:29:27 | call to source |
41+
| structlikeclass.cpp:38:8:38:9 | s4 | structlikeclass.cpp:33:8:33:13 | call to source |
42+
| structlikeclass.cpp:60:8:60:9 | s1 | structlikeclass.cpp:55:40:55:45 | call to source |
43+
| structlikeclass.cpp:61:8:61:9 | s2 | structlikeclass.cpp:58:24:58:29 | call to source |
44+
| structlikeclass.cpp:62:8:62:20 | ... = ... | structlikeclass.cpp:62:13:62:18 | call to source |
4545
| swap1.cpp:60:12:60:16 | data1 | swap1.cpp:58:15:58:20 | call to source |
4646
| swap1.cpp:65:12:65:16 | data1 | swap1.cpp:56:23:56:23 | x |
4747
| swap1.cpp:65:12:65:16 | data1 | swap1.cpp:58:15:58:20 | call to source |

cpp/ql/test/library-tests/dataflow/taint-tests/test_diff.expected

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
| copyableclass.cpp:39:8:39:9 | copyableclass.cpp:33:22:33:27 | AST only |
2-
| copyableclass.cpp:40:8:40:9 | copyableclass.cpp:34:24:34:29 | AST only |
3-
| copyableclass.cpp:41:8:41:9 | copyableclass.cpp:33:22:33:27 | AST only |
4-
| copyableclass.cpp:42:8:42:9 | copyableclass.cpp:37:8:37:13 | AST only |
5-
| copyableclass.cpp:64:8:64:9 | copyableclass.cpp:59:40:59:45 | AST only |
6-
| copyableclass.cpp:65:8:65:9 | copyableclass.cpp:62:24:62:29 | AST only |
7-
| copyableclass.cpp:66:11:66:11 | copyableclass.cpp:66:13:66:18 | AST only |
1+
| copyableclass.cpp:40:8:40:9 | copyableclass.cpp:34:22:34:27 | AST only |
2+
| copyableclass.cpp:41:8:41:9 | copyableclass.cpp:35:24:35:29 | AST only |
3+
| copyableclass.cpp:42:8:42:9 | copyableclass.cpp:34:22:34:27 | AST only |
4+
| copyableclass.cpp:43:8:43:9 | copyableclass.cpp:38:8:38:13 | AST only |
5+
| copyableclass.cpp:65:8:65:9 | copyableclass.cpp:60:40:60:45 | AST only |
6+
| copyableclass.cpp:66:8:66:9 | copyableclass.cpp:63:24:63:29 | AST only |
7+
| copyableclass.cpp:67:11:67:11 | copyableclass.cpp:67:13:67:18 | AST only |
88
| format.cpp:57:8:57:13 | format.cpp:56:36:56:49 | AST only |
99
| format.cpp:62:8:62:13 | format.cpp:61:30:61:43 | AST only |
1010
| format.cpp:67:8:67:13 | format.cpp:66:52:66:65 | AST only |
@@ -15,13 +15,13 @@
1515
| format.cpp:100:8:100:13 | format.cpp:99:30:99:43 | AST only |
1616
| format.cpp:105:8:105:13 | format.cpp:104:31:104:45 | AST only |
1717
| format.cpp:110:8:110:14 | format.cpp:109:38:109:52 | AST only |
18-
| movableclass.cpp:43:8:43:9 | movableclass.cpp:38:21:38:26 | AST only |
19-
| movableclass.cpp:44:8:44:9 | movableclass.cpp:39:23:39:28 | AST only |
20-
| movableclass.cpp:45:8:45:9 | movableclass.cpp:41:8:41:13 | AST only |
21-
| movableclass.cpp:53:8:53:9 | movableclass.cpp:49:38:49:43 | AST only |
22-
| movableclass.cpp:54:8:54:9 | movableclass.cpp:51:23:51:28 | AST only |
23-
| movableclass.cpp:63:8:63:9 | movableclass.cpp:22:55:22:60 | AST only |
24-
| movableclass.cpp:64:11:64:11 | movableclass.cpp:64:13:64:18 | AST only |
18+
| movableclass.cpp:44:8:44:9 | movableclass.cpp:39:21:39:26 | AST only |
19+
| movableclass.cpp:45:8:45:9 | movableclass.cpp:40:23:40:28 | AST only |
20+
| movableclass.cpp:46:8:46:9 | movableclass.cpp:42:8:42:13 | AST only |
21+
| movableclass.cpp:54:8:54:9 | movableclass.cpp:50:38:50:43 | AST only |
22+
| movableclass.cpp:55:8:55:9 | movableclass.cpp:52:23:52:28 | AST only |
23+
| movableclass.cpp:64:8:64:9 | movableclass.cpp:23:55:23:60 | AST only |
24+
| movableclass.cpp:65:11:65:11 | movableclass.cpp:65:13:65:18 | AST only |
2525
| stl.cpp:73:7:73:7 | stl.cpp:69:16:69:21 | AST only |
2626
| stl.cpp:75:9:75:13 | stl.cpp:69:16:69:21 | AST only |
2727
| stl.cpp:125:13:125:17 | stl.cpp:117:10:117:15 | AST only |
@@ -32,10 +32,10 @@
3232
| stl.cpp:156:8:156:9 | stl.cpp:152:8:152:13 | AST only |
3333
| stl.cpp:175:8:175:9 | stl.cpp:171:32:171:37 | AST only |
3434
| stl.cpp:176:8:176:9 | stl.cpp:173:20:173:25 | AST only |
35-
| structlikeclass.cpp:34:8:34:9 | structlikeclass.cpp:28:22:28:27 | AST only |
36-
| structlikeclass.cpp:35:8:35:9 | structlikeclass.cpp:29:24:29:29 | AST only |
37-
| structlikeclass.cpp:36:8:36:9 | structlikeclass.cpp:28:22:28:27 | AST only |
38-
| structlikeclass.cpp:59:8:59:9 | structlikeclass.cpp:54:40:54:45 | AST only |
35+
| structlikeclass.cpp:35:8:35:9 | structlikeclass.cpp:29:22:29:27 | AST only |
36+
| structlikeclass.cpp:36:8:36:9 | structlikeclass.cpp:30:24:30:29 | AST only |
37+
| structlikeclass.cpp:37:8:37:9 | structlikeclass.cpp:29:22:29:27 | AST only |
38+
| structlikeclass.cpp:60:8:60:9 | structlikeclass.cpp:55:40:55:45 | AST only |
3939
| swap1.cpp:65:12:65:16 | swap1.cpp:56:23:56:23 | AST only |
4040
| swap1.cpp:74:13:74:17 | swap1.cpp:69:16:69:21 | AST only |
4141
| swap1.cpp:75:13:75:17 | swap1.cpp:68:27:68:28 | AST only |

cpp/ql/test/library-tests/dataflow/taint-tests/test_ir.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
| format.cpp:158:7:158:27 | ... + ... | format.cpp:148:16:148:30 | call to source |
44
| stl.cpp:71:7:71:7 | (const char *)... | stl.cpp:67:12:67:17 | call to source |
55
| stl.cpp:71:7:71:7 | a | stl.cpp:67:12:67:17 | call to source |
6-
| structlikeclass.cpp:37:8:37:9 | s4 | structlikeclass.cpp:32:8:32:13 | call to source |
7-
| structlikeclass.cpp:60:8:60:9 | s2 | structlikeclass.cpp:57:24:57:29 | call to source |
8-
| structlikeclass.cpp:61:8:61:20 | ... = ... | structlikeclass.cpp:61:13:61:18 | call to source |
6+
| structlikeclass.cpp:38:8:38:9 | s4 | structlikeclass.cpp:33:8:33:13 | call to source |
7+
| structlikeclass.cpp:61:8:61:9 | s2 | structlikeclass.cpp:58:24:58:29 | call to source |
8+
| structlikeclass.cpp:62:8:62:20 | ... = ... | structlikeclass.cpp:62:13:62:18 | call to source |
99
| swap1.cpp:60:12:60:16 | data1 | swap1.cpp:58:15:58:20 | call to source |
1010
| swap1.cpp:65:12:65:16 | data1 | swap1.cpp:58:15:58:20 | call to source |
1111
| swap1.cpp:66:12:66:16 | data1 | swap1.cpp:58:15:58:20 | call to source |

0 commit comments

Comments
 (0)