| 286 | } |
| 287 | |
| 288 | bool CheckStlImpl::isContainerSizeGE(const Token * containerToken, const Token *expr) const |
| 289 | { |
| 290 | if (!expr) |
| 291 | return false; |
| 292 | if (isContainerSize(containerToken, expr)) |
| 293 | return true; |
| 294 | if (expr->str() == "*") { |
| 295 | const Token *mul; |
| 296 | if (isContainerSize(containerToken, expr->astOperand1())) |
| 297 | mul = expr->astOperand2(); |
| 298 | else if (isContainerSize(containerToken, expr->astOperand2())) |
| 299 | mul = expr->astOperand1(); |
| 300 | else |
| 301 | return false; |
| 302 | return mul && (!mul->hasKnownIntValue() || mul->getKnownIntValue() != 0); |
| 303 | } |
| 304 | if (expr->str() == "+") { |
| 305 | const Token *op; |
| 306 | if (isContainerSize(containerToken, expr->astOperand1())) |
| 307 | op = expr->astOperand2(); |
| 308 | else if (isContainerSize(containerToken, expr->astOperand2())) |
| 309 | op = expr->astOperand1(); |
| 310 | else |
| 311 | return false; |
| 312 | return op && op->getValueGE(0, mSettings); |
| 313 | } |
| 314 | return false; |
| 315 | } |
| 316 | |
| 317 | void CheckStlImpl::outOfBoundsIndexExpression() |
| 318 | { |
nothing calls this directly
no test coverage detected