C++: Add failing test case for LargeParameter.ql

This commit is contained in:
Jonas Jensen 2019-01-11 11:53:04 +01:00
Родитель 28261d6787
Коммит 4ea3849595
2 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,4 @@
| 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 |

Просмотреть файл

@ -44,3 +44,11 @@ void myFunction2(mySmallStruct *a, myLargeStruct *b) // GOOD
void myFunction3(mySmallStruct &a, myLargeStruct &b) // GOOD
{
}
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
char data[4096];
};