Fixed VS crash for torture test
This commit is contained in:
parent
a5f202360a
commit
3ebedcd7f5
|
@ -8308,7 +8308,7 @@ void Tokenizer::validate() const
|
||||||
cppcheckError(lastTok);
|
cppcheckError(lastTok);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Token *findUnmatchedTernaryOp(const Token * const begin, const Token * const end)
|
static const Token *findUnmatchedTernaryOp(const Token * const begin, const Token * const end, unsigned depth = 0)
|
||||||
{
|
{
|
||||||
std::stack<const Token *> ternaryOp;
|
std::stack<const Token *> ternaryOp;
|
||||||
for (const Token *tok = begin; tok != end && tok->str() != ";"; tok = tok->next()) {
|
for (const Token *tok = begin; tok != end && tok->str() != ";"; tok = tok->next()) {
|
||||||
|
@ -8316,8 +8316,8 @@ static const Token *findUnmatchedTernaryOp(const Token * const begin, const Toke
|
||||||
ternaryOp.push(tok);
|
ternaryOp.push(tok);
|
||||||
else if (!ternaryOp.empty() && tok->str() == ":")
|
else if (!ternaryOp.empty() && tok->str() == ":")
|
||||||
ternaryOp.pop();
|
ternaryOp.pop();
|
||||||
else if (Token::Match(tok,"(|[")) {
|
else if (depth < 100 && Token::Match(tok,"(|[")) {
|
||||||
const Token *inner = findUnmatchedTernaryOp(tok->next(), tok->link());
|
const Token *inner = findUnmatchedTernaryOp(tok->next(), tok->link(), depth+1);
|
||||||
if (inner)
|
if (inner)
|
||||||
return inner;
|
return inner;
|
||||||
tok = tok->link();
|
tok = tok->link();
|
||||||
|
|
Loading…
Reference in New Issue