Skip to content
Snippets Groups Projects
Commit 8a1e2d0f authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

CppEditor: Fix type hierarchy for forward declarations


The wrong LookupContext/Document was used to lookup the type.

Task-number: QTCREATORBUG-10353
Change-Id: Iac501ca368543716b5f38b6d2bec474ab585e189
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 98c98478
No related branches found
No related tags found
No related merge requests found
......@@ -176,14 +176,21 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
|| (declaration->isTemplate() && declaration->asTemplate()->declaration()
&& (declaration->asTemplate()->declaration()->isClass()
|| declaration->asTemplate()->declaration()->isForwardClassDeclaration()))) {
LookupContext contextToUse = context;
if (declaration->isForwardClassDeclaration())
if (Symbol *classDeclaration =
m_symbolFinder.findMatchingClassDeclaration(declaration, snapshot)) {
declaration = classDeclaration;
const QString fileName = QString::fromUtf8(declaration->fileName(),
declaration->fileNameLength());
const Document::Ptr declarationDocument = snapshot.document(fileName);
if (declarationDocument != context.thisDocument())
contextToUse = LookupContext(declarationDocument, snapshot);
}
CppClass *cppClass = new CppClass(declaration);
if (m_lookupBaseClasses)
cppClass->lookupBases(declaration, context);
cppClass->lookupBases(declaration, contextToUse);
if (m_lookupDerivedClasses)
cppClass->lookupDerived(declaration, snapshot);
m_element = QSharedPointer<CppElement>(cppClass);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment