Skip to content

Commit 4d57075

Browse files
Update checkstl.cpp
1 parent a4b7dbc commit 4d57075

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

lib/checkstl.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,20 +2003,17 @@ static bool isc_strConstructor(const Token* tok)
20032003
{
20042004
if (!tok->valueType() || !Token::Match(tok, "%var% (|{"))
20052005
return false;
2006-
2007-
const Token* callTok = tok->tokAt(1)->astOperand2();
2008-
while (Token::simpleMatch(callTok, "+") && callTok->isBinaryOp()) {
2009-
if (callTok->astOperand1()->str() == "+") {
2010-
callTok = callTok->astOperand1();
2011-
continue;
2006+
bool result = false;
2007+
visitAstNodes(tok->tokAt(1)->astOperand2(), [&](const Token* tok2) {
2008+
if (Token::simpleMatch(tok2, "+"))
2009+
return ChildrenToVisit::op1_and_op2;
2010+
if (isc_strCall(tok2, tok->valueType()->container)) {
2011+
result = true;
2012+
return ChildrenToVisit::done;
20122013
}
2013-
if (callTok->astOperand1()->str() == "(")
2014-
callTok = callTok->astOperand1();
2015-
else if (callTok->astOperand2()->str() == "(")
2016-
callTok = callTok->astOperand2();
2017-
break;
2018-
}
2019-
return isc_strCall(callTok, tok->valueType()->container);
2014+
return ChildrenToVisit::none;
2015+
});
2016+
return result;
20202017
}
20212018

20222019
namespace {

0 commit comments

Comments
 (0)