Skip to content

Commit

Permalink
Update valueflow.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Aug 9, 2024
1 parent 9be8ed3 commit 4659994
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7125,7 +7125,9 @@ static void valueFlowContainerSize(const TokenList& tokenlist,
for (const ValueFlow::Value& value : values)
setTokenValue(tok, value, settings);
} else if (Token::Match(tok, "%name%|;|{|}|> %var% =") && Token::Match(tok->tokAt(2)->astOperand2(), "[({]") &&
(tok->tokAt(2) == tok->tokAt(2)->astOperand2()->astParent() ||
// init list
((tok->tokAt(2) == tok->tokAt(2)->astOperand2()->astParent() && !tok->tokAt(2)->astOperand2()->astOperand2() && tok->tokAt(2)->astOperand2()->str() == "{") ||
// constructor
(!Token::simpleMatch(tok->tokAt(2)->astOperand2()->astOperand1(), ".") && settings.library.detectContainer(tok->tokAt(3))))) {
Token* containerTok = tok->next();
if (containerTok->exprId() == 0)
Expand Down

0 comments on commit 4659994

Please sign in to comment.