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:
Nikolai Kosjar
2015-10-09 18:13:49 +02:00
parent 6b6ad446eb
commit b2713716b9
2 changed files with 7 additions and 5 deletions

View File

@@ -32,6 +32,7 @@
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cpptoolsreuse.h>
#include <cpptools/symbolfinder.h>
#include <cpptools/typehierarchybuilder.h>
#include <texteditor/textdocument.h>
@@ -180,9 +181,11 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
&& (declaration->asTemplate()->declaration()->isClass()
|| declaration->asTemplate()->declaration()->isForwardClassDeclaration()))) {
LookupContext contextToUse = context;
if (declaration->isForwardClassDeclaration())
if (Symbol *classDeclaration =
m_symbolFinder.findMatchingClassDeclaration(declaration, snapshot)) {
if (declaration->isForwardClassDeclaration()) {
const auto symbolFinder = m_modelManager->symbolFinder();
Symbol *classDeclaration = symbolFinder->findMatchingClassDeclaration(declaration,
snapshot);
if (classDeclaration) {
declaration = classDeclaration;
const QString fileName = QString::fromUtf8(declaration->fileName(),
declaration->fileNameLength());
@@ -190,6 +193,7 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
if (declarationDocument != context.thisDocument())
contextToUse = LookupContext(declarationDocument, snapshot);
}
}
CppClass *cppClass = new CppClass(declaration);
if (m_lookupBaseClasses)

View File

@@ -31,7 +31,6 @@
#ifndef CPPELEMENTEVALUATOR_H
#define CPPELEMENTEVALUATOR_H
#include <cpptools/symbolfinder.h>
#include <texteditor/texteditor.h>
#include <texteditor/helpitem.h>
@@ -88,7 +87,6 @@ private:
bool m_lookupDerivedClasses;
QSharedPointer<CppElement> m_element;
QString m_diagnosis;
CppTools::SymbolFinder m_symbolFinder;
};
class CppElement