mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
C++: Exclude copy assignment in LargeParameter.ql
The purpose of the copy assignment operator is to copy the object, so we should not complain that a copy happens when passing the parameter. See https://en.wikibooks.org/wiki/More_C++_Idioms/Copy-and-swap for details.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
| 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 |
|
||||
| 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> |
|
||||
| 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 |
|
||||
| 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 |
|
||||
|
||||
@@ -49,6 +49,6 @@ struct CustomAssignmentOp {
|
||||
// GOOD: it's an accepted pattern to implement copy assignment via copy and
|
||||
// swap. This delegates the resource management involved in copying to the
|
||||
// copy constructor so that logic only has to be written once.
|
||||
CustomAssignmentOp &operator=(CustomAssignmentOp rhs); // FALSE POSITIVE
|
||||
CustomAssignmentOp &operator=(CustomAssignmentOp rhs);
|
||||
char data[4096];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user