fix daca crashes in Type::findDependency() (#3101)
This commit is contained in:
parent
b2fbab18fd
commit
5810171336
|
@ -3139,7 +3139,7 @@ bool Type::findDependency(const Type* ancestor) const
|
||||||
if (this==ancestor)
|
if (this==ancestor)
|
||||||
return true;
|
return true;
|
||||||
for (std::vector<BaseInfo>::const_iterator parent=derivedFrom.begin(); parent!=derivedFrom.end(); ++parent) {
|
for (std::vector<BaseInfo>::const_iterator parent=derivedFrom.begin(); parent!=derivedFrom.end(); ++parent) {
|
||||||
if (parent->type && parent->type->findDependency(ancestor))
|
if (parent->type && (parent->type == this || parent->type->findDependency(ancestor)))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -344,6 +344,7 @@ private:
|
||||||
TEST_CASE(symboldatabase89); // valuetype name
|
TEST_CASE(symboldatabase89); // valuetype name
|
||||||
TEST_CASE(symboldatabase90);
|
TEST_CASE(symboldatabase90);
|
||||||
TEST_CASE(symboldatabase91);
|
TEST_CASE(symboldatabase91);
|
||||||
|
TEST_CASE(symboldatabase92); // daca crash
|
||||||
|
|
||||||
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
||||||
|
|
||||||
|
@ -4680,6 +4681,14 @@ private:
|
||||||
ASSERT(functok->function()->name() == "foo");
|
ASSERT(functok->function()->name() == "foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void symboldatabase92() { // daca crash
|
||||||
|
GET_SYMBOL_DB("template <size_t, typename...> struct a;\n"
|
||||||
|
"template <size_t b, typename c, typename... d>\n"
|
||||||
|
"struct a<b, c, d...> : a<1, d...> {};\n"
|
||||||
|
"template <typename... e> struct f : a<0, e...> {};");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void createSymbolDatabaseFindAllScopes1() {
|
void createSymbolDatabaseFindAllScopes1() {
|
||||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||||
ASSERT(db->scopeList.size() == 3);
|
ASSERT(db->scopeList.size() == 3);
|
||||||
|
|
Loading…
Reference in New Issue