| 6610 | } |
| 6611 | |
| 6612 | static void valueFlowContainerSetTokValue(const TokenList& tokenlist, ErrorLogger& errorLogger, const Settings& settings, const Token* tok, Token* initList) |
| 6613 | { |
| 6614 | ValueFlow::Value value; |
| 6615 | value.valueType = ValueFlow::Value::ValueType::TOK; |
| 6616 | value.tokvalue = initList; |
| 6617 | if (astIsContainerString(tok) && Token::simpleMatch(initList, "{") && Token::Match(initList->astOperand2(), "%str%")) { |
| 6618 | value.tokvalue = initList->astOperand2(); |
| 6619 | } |
| 6620 | value.setKnown(); |
| 6621 | Token* start = initList->link() ? initList->link() : initList->next(); |
| 6622 | if (tok->variable() && tok->variable()->isConst()) { |
| 6623 | valueFlowForwardConst(start, tok->variable()->scope()->bodyEnd, tok->variable(), {std::move(value)}, settings); |
| 6624 | } else { |
| 6625 | valueFlowForward(start, tok, std::move(value), tokenlist, errorLogger, settings); |
| 6626 | } |
| 6627 | } |
| 6628 | |
| 6629 | static const Scope* getFunctionScope(const Scope* scope) { |
| 6630 | while (scope && scope->type != ScopeType::eFunction) |
no test coverage detected