Fix C++ type hierarchy

Dynamic casts between library boundaries tend to fail. Add an "explicit
cast" to CppClass via virtual functions as a quickfix.
This is a recurring issue, e.g. d2769f3003, 3f11ef9216 and
2ffd0e2d0d to name just a few...

This was introduced in 5e861d2be6

Task-number: QTCREATORBUG-20001
Change-Id: Ie5a89a028d587e4e9d1ecec920a7c7d17497dbde
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Eike Ziller
2018-03-08 19:25:04 +01:00
parent 32188f448a
commit 711ac6602f
3 changed files with 19 additions and 3 deletions

View File

@@ -63,6 +63,11 @@ CppElement::CppElement() : helpCategory(TextEditor::HelpItem::Unknown)
CppElement::~CppElement()
{}
CppClass *CppElement::toCppClass()
{
return nullptr;
}
class Unknown : public CppElement
{
public:
@@ -156,6 +161,11 @@ bool CppClass::operator==(const CppClass &other)
return this->declaration == other.declaration;
}
CppClass *CppClass::toCppClass()
{
return this;
}
void CppClass::lookupBases(Symbol *declaration, const LookupContext &context)
{
typedef QPair<ClassOrNamespace *, CppClass *> Data;