Fixed #8697 (noreturn output stream)
This commit is contained in:
parent
a30941d885
commit
866d198756
|
@ -904,6 +904,14 @@ bool Library::isScopeNoReturn(const Token *end, std::string *unknownFunc) const
|
||||||
if (unknownFunc)
|
if (unknownFunc)
|
||||||
unknownFunc->clear();
|
unknownFunc->clear();
|
||||||
|
|
||||||
|
if (Token::Match(end->tokAt(-2), "!!{ ; }")) {
|
||||||
|
const Token *lastTop = end->tokAt(-2)->astTop();
|
||||||
|
if (Token::simpleMatch(lastTop, "<<") &&
|
||||||
|
Token::simpleMatch(lastTop->astOperand1(), "(") &&
|
||||||
|
Token::Match(lastTop->astOperand1()->previous(), "%name% ("))
|
||||||
|
return isnoreturn(lastTop->astOperand1()->previous());
|
||||||
|
}
|
||||||
|
|
||||||
if (!Token::simpleMatch(end->tokAt(-2), ") ; }"))
|
if (!Token::simpleMatch(end->tokAt(-2), ") ; }"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -3358,6 +3358,14 @@ private:
|
||||||
" x.front();\n" // <- unknown container size
|
" x.front();\n" // <- unknown container size
|
||||||
"}";
|
"}";
|
||||||
ASSERT(tokenValues(code, "x . front").empty());
|
ASSERT(tokenValues(code, "x . front").empty());
|
||||||
|
|
||||||
|
code = "void f(std::vector<int> ints) {\n" // #8697
|
||||||
|
" if (ints.empty())\n"
|
||||||
|
" abort() << 123;\n"
|
||||||
|
" ints[0] = 0;\n"
|
||||||
|
"}";
|
||||||
|
ASSERT(tokenValues(code, "ints [").empty());
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue