Fix 10672: crash: CheckAutoVariables (#3657)
This commit is contained in:
parent
922e27de4c
commit
7bf0ca8d00
|
@ -563,7 +563,9 @@ static const Token* getParentLifetime(bool cpp, const Token* tok, const Library*
|
||||||
const Token* dotTok = tok2->next();
|
const Token* dotTok = tok2->next();
|
||||||
if (!Token::simpleMatch(dotTok, ".")) {
|
if (!Token::simpleMatch(dotTok, ".")) {
|
||||||
const Token* endTok = nextAfterAstRightmostLeaf(tok2);
|
const Token* endTok = nextAfterAstRightmostLeaf(tok2);
|
||||||
if (Token::simpleMatch(endTok, "."))
|
if (!endTok)
|
||||||
|
dotTok = tok2->next();
|
||||||
|
else if (Token::simpleMatch(endTok, "."))
|
||||||
dotTok = endTok;
|
dotTok = endTok;
|
||||||
else if (Token::simpleMatch(endTok->next(), "."))
|
else if (Token::simpleMatch(endTok->next(), "."))
|
||||||
dotTok = endTok->next();
|
dotTok = endTok->next();
|
||||||
|
|
|
@ -415,8 +415,8 @@ private:
|
||||||
// #9052
|
// #9052
|
||||||
TEST_CASE(noCrash1);
|
TEST_CASE(noCrash1);
|
||||||
TEST_CASE(noCrash2);
|
TEST_CASE(noCrash2);
|
||||||
|
|
||||||
TEST_CASE(noCrash3);
|
TEST_CASE(noCrash3);
|
||||||
|
TEST_CASE(noCrash4);
|
||||||
|
|
||||||
// --check-config
|
// --check-config
|
||||||
TEST_CASE(checkConfiguration);
|
TEST_CASE(checkConfiguration);
|
||||||
|
@ -6963,6 +6963,15 @@ private:
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify("void a(X<int> x, typename Y1::Y2<int, A::B::C, 2> y, Z z = []{});"));
|
ASSERT_NO_THROW(tokenizeAndStringify("void a(X<int> x, typename Y1::Y2<int, A::B::C, 2> y, Z z = []{});"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void noCrash4()
|
||||||
|
{
|
||||||
|
ASSERT_NO_THROW(tokenizeAndStringify("static int foo() {\n"
|
||||||
|
" zval ref ;\n"
|
||||||
|
" p = &(ref).value;\n"
|
||||||
|
" return result ;\n"
|
||||||
|
"}\n"));
|
||||||
|
}
|
||||||
|
|
||||||
void checkConfig(const char code[]) {
|
void checkConfig(const char code[]) {
|
||||||
errout.str("");
|
errout.str("");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue