| 1400 | enum class LifetimeCapture : std::uint8_t { Undefined, ByValue, ByReference }; |
| 1401 | |
| 1402 | static std::string lifetimeType(const Token *tok, const ValueFlow::Value *val) |
| 1403 | { |
| 1404 | if (!val) |
| 1405 | return "object"; |
| 1406 | switch (val->lifetimeKind) { |
| 1407 | case ValueFlow::Value::LifetimeKind::Lambda: |
| 1408 | return "lambda"; |
| 1409 | case ValueFlow::Value::LifetimeKind::Iterator: |
| 1410 | return "iterator"; |
| 1411 | case ValueFlow::Value::LifetimeKind::Object: |
| 1412 | case ValueFlow::Value::LifetimeKind::SubObject: |
| 1413 | case ValueFlow::Value::LifetimeKind::Address: |
| 1414 | if (astIsPointer(tok)) |
| 1415 | return "pointer"; |
| 1416 | if (Token::simpleMatch(tok, "=") && astIsPointer(tok->astOperand2())) |
| 1417 | return "pointer"; |
| 1418 | return "object"; |
| 1419 | } |
| 1420 | |
| 1421 | cppcheck::unreachable(); |
| 1422 | } |
| 1423 | |
| 1424 | std::string ValueFlow::lifetimeMessage(const Token *tok, const ValueFlow::Value *val, ErrorPath &errorPath) |
| 1425 | { |
no test coverage detected