| 405 | } |
| 406 | |
| 407 | static bool isIterator(const Variable *var, bool& inconclusiveType) |
| 408 | { |
| 409 | // Check that its an iterator |
| 410 | if (!var || !var->isLocal() || !Token::Match(var->typeEndToken(), "iterator|const_iterator|reverse_iterator|const_reverse_iterator|auto")) |
| 411 | return false; |
| 412 | |
| 413 | inconclusiveType = false; |
| 414 | if (var->typeEndToken()->str() == "auto") |
| 415 | return (var->nameToken()->valueType() && var->nameToken()->valueType()->type == ValueType::Type::ITERATOR); |
| 416 | |
| 417 | if (var->type()) { // If it is defined, ensure that it is defined like an iterator |
| 418 | // look for operator* and operator++ |
| 419 | const Function* end = var->type()->getFunction("operator*"); |
| 420 | const Function* incOperator = var->type()->getFunction("operator++"); |
| 421 | if (!end || end->argCount() > 0 || !incOperator) |
| 422 | return false; |
| 423 | |
| 424 | inconclusiveType = true; // heuristics only |
| 425 | } |
| 426 | |
| 427 | return true; |
| 428 | } |
| 429 | |
| 430 | static std::string getContainerName(const Token *containerToken) |
| 431 | { |
no test coverage detected