CppTools: Check if project has changed before reparsing

This introduces an API change for the project managers. Those are not
expected to call updateSourceFiles() anymore.

Task-number: QTCREATORBUG-9581
Change-Id: I77befd29fb851c9acf87204d571da00183c9cd05
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-07-16 12:08:39 +02:00
parent d0e5facb0e
commit 072b7c5718
11 changed files with 83 additions and 28 deletions

View File

@@ -547,17 +547,24 @@ CppModelManager::ProjectInfo CppModelManager::projectInfo(ProjectExplorer::Proje
return m_projects.value(project, ProjectInfo(project));
}
void CppModelManager::updateProjectInfo(const ProjectInfo &pinfo)
QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &pinfo)
{
{ // only hold the mutex for a limited scope, so the dumping afterwards can aquire it without deadlocking.
QMutexLocker locker(&m_projectMutex);
if (! pinfo.isValid())
return;
return QFuture<void>();
ProjectExplorer::Project *project = pinfo.project().data();
ProjectInfo oldProjectInfo = m_projects.value(project);
if (oldProjectInfo.isValid()) {
if (pinfo.defines() == oldProjectInfo.defines()
&& pinfo.includePaths() == oldProjectInfo.includePaths()
&& pinfo.frameworkPaths() == oldProjectInfo.frameworkPaths()
&& pinfo.sourceFiles() == oldProjectInfo.sourceFiles()) {
return QFuture<void>();
}
foreach (const ProjectPart::Ptr &projectPart, oldProjectInfo.projectParts()) {
foreach (const ProjectFile &cxxFile, projectPart->files) {
foreach (const QString &fileName,
@@ -587,6 +594,8 @@ void CppModelManager::updateProjectInfo(const ProjectInfo &pinfo)
dumpModelManagerConfiguration();
emit projectPartsUpdated(pinfo.project().data());
return updateSourceFiles(pinfo.sourceFiles(), ForcedProgressNotification);
}
QList<ProjectPart::Ptr> CppModelManager::projectPart(const QString &fileName) const