forked from qt-creator/qt-creator
CppEditor: Use SymbolFinder from CppModelManager in CppElementEvaluator
...in order to profit from its file iteration cache. Change-Id: I3b7c3e7bd3fd24b0a4dfa29f83158baa9414cc06 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
#include <cpptools/cpptoolsreuse.h>
|
#include <cpptools/cpptoolsreuse.h>
|
||||||
|
#include <cpptools/symbolfinder.h>
|
||||||
#include <cpptools/typehierarchybuilder.h>
|
#include <cpptools/typehierarchybuilder.h>
|
||||||
|
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
@@ -180,9 +181,11 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
|
|||||||
&& (declaration->asTemplate()->declaration()->isClass()
|
&& (declaration->asTemplate()->declaration()->isClass()
|
||||||
|| declaration->asTemplate()->declaration()->isForwardClassDeclaration()))) {
|
|| declaration->asTemplate()->declaration()->isForwardClassDeclaration()))) {
|
||||||
LookupContext contextToUse = context;
|
LookupContext contextToUse = context;
|
||||||
if (declaration->isForwardClassDeclaration())
|
if (declaration->isForwardClassDeclaration()) {
|
||||||
if (Symbol *classDeclaration =
|
const auto symbolFinder = m_modelManager->symbolFinder();
|
||||||
m_symbolFinder.findMatchingClassDeclaration(declaration, snapshot)) {
|
Symbol *classDeclaration = symbolFinder->findMatchingClassDeclaration(declaration,
|
||||||
|
snapshot);
|
||||||
|
if (classDeclaration) {
|
||||||
declaration = classDeclaration;
|
declaration = classDeclaration;
|
||||||
const QString fileName = QString::fromUtf8(declaration->fileName(),
|
const QString fileName = QString::fromUtf8(declaration->fileName(),
|
||||||
declaration->fileNameLength());
|
declaration->fileNameLength());
|
||||||
@@ -190,6 +193,7 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
|
|||||||
if (declarationDocument != context.thisDocument())
|
if (declarationDocument != context.thisDocument())
|
||||||
contextToUse = LookupContext(declarationDocument, snapshot);
|
contextToUse = LookupContext(declarationDocument, snapshot);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CppClass *cppClass = new CppClass(declaration);
|
CppClass *cppClass = new CppClass(declaration);
|
||||||
if (m_lookupBaseClasses)
|
if (m_lookupBaseClasses)
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#ifndef CPPELEMENTEVALUATOR_H
|
#ifndef CPPELEMENTEVALUATOR_H
|
||||||
#define CPPELEMENTEVALUATOR_H
|
#define CPPELEMENTEVALUATOR_H
|
||||||
|
|
||||||
#include <cpptools/symbolfinder.h>
|
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
#include <texteditor/helpitem.h>
|
#include <texteditor/helpitem.h>
|
||||||
|
|
||||||
@@ -88,7 +87,6 @@ private:
|
|||||||
bool m_lookupDerivedClasses;
|
bool m_lookupDerivedClasses;
|
||||||
QSharedPointer<CppElement> m_element;
|
QSharedPointer<CppElement> m_element;
|
||||||
QString m_diagnosis;
|
QString m_diagnosis;
|
||||||
CppTools::SymbolFinder m_symbolFinder;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CppElement
|
class CppElement
|
||||||
|
|||||||
Reference in New Issue
Block a user