| 1518 | } |
| 1519 | |
| 1520 | static bool isLargeContainer(const Variable* var, const Settings& settings) |
| 1521 | { |
| 1522 | const ValueType* vt = var->valueType(); |
| 1523 | if (vt->container->startPattern == "std :: initializer_list <") |
| 1524 | return false; |
| 1525 | if (vt->container->size_templateArgNo < 0) |
| 1526 | return true; |
| 1527 | const std::size_t maxByValueSize = 2 * settings.platform.sizeof_pointer; |
| 1528 | if (var->dimensions().empty()) { |
| 1529 | if (vt->container->startPattern == "std :: bitset <") { |
| 1530 | if (const ValueFlow::Value* v = vt->containerTypeToken->getKnownValue(ValueFlow::Value::ValueType::INT)) |
| 1531 | return v->intvalue / 8 > maxByValueSize; |
| 1532 | } |
| 1533 | return false; |
| 1534 | } |
| 1535 | const ValueType vtElem = ValueType::parseDecl(vt->containerTypeToken, settings); |
| 1536 | const auto elemSize = std::max<std::size_t>(vtElem.getSizeOf(settings, ValueType::Accuracy::LowerBound, ValueType::SizeOf::Pointer), 1); |
| 1537 | const auto arraySize = var->dimension(0) * elemSize; |
| 1538 | return arraySize > maxByValueSize; |
| 1539 | } |
| 1540 | |
| 1541 | void CheckOtherImpl::checkPassByReference() |
| 1542 | { |
no test coverage detected