From b2713716b9718a8c3356cb038535e23063aab6bb Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 9 Oct 2015 18:13:49 +0200 Subject: [PATCH] CppEditor: Use SymbolFinder from CppModelManager in CppElementEvaluator ...in order to profit from its file iteration cache. Change-Id: I3b7c3e7bd3fd24b0a4dfa29f83158baa9414cc06 Reviewed-by: Marco Bubke --- src/plugins/cppeditor/cppelementevaluator.cpp | 10 +++++++--- src/plugins/cppeditor/cppelementevaluator.h | 2 -- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp index 119ab2d69b1..97b25d723f7 100644 --- a/src/plugins/cppeditor/cppelementevaluator.cpp +++ b/src/plugins/cppeditor/cppelementevaluator.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -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) diff --git a/src/plugins/cppeditor/cppelementevaluator.h b/src/plugins/cppeditor/cppelementevaluator.h index 16fc718f482..1bbb44f5120 100644 --- a/src/plugins/cppeditor/cppelementevaluator.h +++ b/src/plugins/cppeditor/cppelementevaluator.h @@ -31,7 +31,6 @@ #ifndef CPPELEMENTEVALUATOR_H #define CPPELEMENTEVALUATOR_H -#include #include #include @@ -88,7 +87,6 @@ private: bool m_lookupDerivedClasses; QSharedPointer m_element; QString m_diagnosis; - CppTools::SymbolFinder m_symbolFinder; }; class CppElement