Skip to content

Commit 4ea3849

Browse files
committed
C++: Add failing test case for LargeParameter.ql
1 parent 28261d6 commit 4ea3849

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
| test.cpp:16:13:16:14 | _t | This parameter of type $@ is 4096 bytes - consider passing a pointer/reference instead. | test.cpp:6:8:6:20 | myLargeStruct | myLargeStruct |
22
| test.cpp:24:44:24:48 | mtc_t | This parameter of type $@ is 4096 bytes - consider passing a pointer/reference instead. | test.cpp:11:7:11:21 | myTemplateClass<myLargeStruct> | myTemplateClass<myLargeStruct> |
33
| test.cpp:28:49:28:49 | b | This parameter of type $@ is 4096 bytes - consider passing a pointer/reference instead. | test.cpp:6:8:6:20 | myLargeStruct | myLargeStruct |
4+
| test.cpp:52:52:52:54 | rhs | This parameter of type $@ is 4096 bytes - consider passing a pointer/reference instead. | test.cpp:48:8:48:25 | CustomAssignmentOp | CustomAssignmentOp |

cpp/ql/test/query-tests/Critical/LargeParameter/test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,11 @@ void myFunction2(mySmallStruct *a, myLargeStruct *b) // GOOD
4444
void myFunction3(mySmallStruct &a, myLargeStruct &b) // GOOD
4545
{
4646
}
47+
48+
struct CustomAssignmentOp {
49+
// GOOD: it's an accepted pattern to implement copy assignment via copy and
50+
// swap. This delegates the resource management involved in copying to the
51+
// copy constructor so that logic only has to be written once.
52+
CustomAssignmentOp &operator=(CustomAssignmentOp rhs); // FALSE POSITIVE
53+
char data[4096];
54+
};

0 commit comments

Comments
 (0)