MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / isLargeObject

Function isLargeObject

lib/checkother.cpp:3325–3332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3323}
3324
3325static bool isLargeObject(const Variable* var, const Settings& settings)
3326{
3327 if (!var || var->isGlobal() || !var->valueType())
3328 return false;
3329 ValueType vt = *var->valueType();
3330 vt.reference = Reference::None;
3331 return vt.getSizeOf(settings, ValueType::Accuracy::LowerBound, ValueType::SizeOf::Pointer) > 2 * settings.platform.sizeof_pointer;
3332}
3333
3334//---------------------------------------------------------------------------
3335// This check rule works for checking the "const A a = getA()" usage when getA() returns "const A &" or "A &".

Callers 2

checkFunctionReturnsRefFunction · 0.85
checkVariableAssignmentFunction · 0.85

Calls 2

getSizeOfMethod · 0.80
isGlobalMethod · 0.45

Tested by

no test coverage detected