CppTools: Remove some duplication

Change-Id: I8c84660b28c3e76b2cedd08ff3b44a38583f38a0
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-12-14 18:58:23 +01:00
parent 5421615070
commit bd66d5ac05
15 changed files with 59 additions and 56 deletions

View File

@@ -36,11 +36,13 @@ ClangEditorDocumentParser::ClangEditorDocumentParser(const QString &filePath)
}
void ClangEditorDocumentParser::updateImpl(const QFutureInterface<void> &,
const CppTools::WorkingCopy &,
const ProjectExplorer::Project *activeProject)
const UpdateParams &updateParams)
{
State state_ = state();
state_.projectPart = determineProjectPart(filePath(), configuration(), state_, activeProject);
state_.projectPart = determineProjectPart(filePath(),
configuration(),
state_,
updateParams.activeProject);
setState(state_);
}

View File

@@ -38,8 +38,7 @@ public:
private:
void updateImpl(const QFutureInterface<void> &future,
const CppTools::WorkingCopy &,
const ProjectExplorer::Project *activeProject) override;
const UpdateParams &updateParams) override;
};
} // namespace ClangCodeModel

View File

@@ -46,8 +46,6 @@
#include <cpptools/cppworkingcopy.h>
#include <cpptools/editordocumenthandle.h>
#include <projectexplorer/session.h>
#include <texteditor/convenience.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditor.h>
@@ -103,7 +101,8 @@ ClangEditorDocumentProcessor::~ClangEditorDocumentProcessor()
}
}
void ClangEditorDocumentProcessor::run()
void ClangEditorDocumentProcessor::runImpl(
const CppTools::BaseEditorDocumentParser::UpdateParams &updateParams)
{
m_updateTranslationUnitTimer.start();
@@ -116,13 +115,7 @@ void ClangEditorDocumentProcessor::run()
m_parserRevision = revision();
connect(&m_parserWatcher, &QFutureWatcher<void>::finished,
this, &ClangEditorDocumentProcessor::onParserFinished);
const CppTools::WorkingCopy workingCopy = CppTools::CppModelManager::instance()->workingCopy();
const ProjectExplorer::Project *activeProject
= ProjectExplorer::SessionManager::startupProject();
const QFuture<void> future = ::Utils::runAsync(&runParser,
parser(),
workingCopy,
activeProject);
const QFuture<void> future = ::Utils::runAsync(&runParser, parser(), updateParams);
m_parserWatcher.setFuture(future);
// Run builtin processor

View File

@@ -55,7 +55,7 @@ public:
~ClangEditorDocumentProcessor();
// BaseEditorDocumentProcessor interface
void run() override;
void runImpl(const CppTools::BaseEditorDocumentParser::UpdateParams &updateParams) override;
void semanticRehighlight() override;
void recalculateSemanticInfoDetached(bool force) override;
CppTools::SemanticInfo recalculateSemanticInfo() override;