Commit 8a1e2d0f authored by Nikolai Kosjar's avatar Nikolai Kosjar

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
...@@ -176,14 +176,21 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot, ...@@ -176,14 +176,21 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
|| (declaration->isTemplate() && declaration->asTemplate()->declaration() || (declaration->isTemplate() && declaration->asTemplate()->declaration()
&& (declaration->asTemplate()->declaration()->isClass() && (declaration->asTemplate()->declaration()->isClass()
|| declaration->asTemplate()->declaration()->isForwardClassDeclaration()))) { || declaration->asTemplate()->declaration()->isForwardClassDeclaration()))) {
LookupContext contextToUse = context;
if (declaration->isForwardClassDeclaration()) if (declaration->isForwardClassDeclaration())
if (Symbol *classDeclaration = if (Symbol *classDeclaration =
m_symbolFinder.findMatchingClassDeclaration(declaration, snapshot)) { m_symbolFinder.findMatchingClassDeclaration(declaration, snapshot)) {
declaration = classDeclaration; 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); CppClass *cppClass = new CppClass(declaration);
if (m_lookupBaseClasses) if (m_lookupBaseClasses)
cppClass->lookupBases(declaration, context); cppClass->lookupBases(declaration, contextToUse);
if (m_lookupDerivedClasses) if (m_lookupDerivedClasses)
cppClass->lookupDerived(declaration, snapshot); cppClass->lookupDerived(declaration, snapshot);
m_element = QSharedPointer<CppElement>(cppClass); m_element = QSharedPointer<CppElement>(cppClass);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment