Fixed crash on garbage code #6859
This commit is contained in:
parent
860ea4fe48
commit
ab1113fb16
|
@ -284,7 +284,7 @@ static bool isVariableChanged(const Token *start, const Token *end, const unsign
|
||||||
while (parent && parent->str() == ",")
|
while (parent && parent->str() == ",")
|
||||||
parent = parent->astParent();
|
parent = parent->astParent();
|
||||||
if (parent && parent->str() == "(") {
|
if (parent && parent->str() == "(") {
|
||||||
if (parent->astOperand1()->isName() && !parent->astOperand1()->function())
|
if (parent->astOperand1() && parent->astOperand1()->isName() && !parent->astOperand1()->function())
|
||||||
return true;
|
return true;
|
||||||
// TODO: check if function parameter is non-const reference etc..
|
// TODO: check if function parameter is non-const reference etc..
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,7 @@ private:
|
||||||
TEST_CASE(garbageCode102); // #6846
|
TEST_CASE(garbageCode102); // #6846
|
||||||
TEST_CASE(garbageCode103); // #6824
|
TEST_CASE(garbageCode103); // #6824
|
||||||
TEST_CASE(garbageCode104); // #6847
|
TEST_CASE(garbageCode104); // #6847
|
||||||
|
TEST_CASE(garbageCode105); // #6859
|
||||||
|
|
||||||
TEST_CASE(garbageValueFlow);
|
TEST_CASE(garbageValueFlow);
|
||||||
TEST_CASE(garbageSymbolDatabase);
|
TEST_CASE(garbageSymbolDatabase);
|
||||||
|
@ -814,6 +815,10 @@ private:
|
||||||
ASSERT_THROW(checkCode("template < Types > struct S {> ( S < ) S >} { ( ) { } } ( ) { return S < void > ( ) } { ( )> >} { ( ) { } } ( ) { ( ) }"), InternalError);
|
ASSERT_THROW(checkCode("template < Types > struct S {> ( S < ) S >} { ( ) { } } ( ) { return S < void > ( ) } { ( )> >} { ( ) { } } ( ) { ( ) }"), InternalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void garbageCode105() { // #6859
|
||||||
|
checkCode("void foo (int i) { int a , for (a 1; a( < 4; a++) if (a) (b b++) (b);) n++; }");
|
||||||
|
}
|
||||||
|
|
||||||
void garbageValueFlow() {
|
void garbageValueFlow() {
|
||||||
// #6089
|
// #6089
|
||||||
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
||||||
|
|
Loading…
Reference in New Issue