summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2017-02-27 11:34:30 +0100
committerNikolai Kosjar <nikolai.kosjar@qt.io>2017-03-07 11:54:16 +0000
commit45b7c5ac293a297ff1c6c7e64b24d662ec29b7b2 (patch)
treec95b2c4d42459d28464340a44fa5b3e4900499a6 /src/plugins
parent95f78f6c8002aa95affe13b4c528a147e40240b1 (diff)
downloadqt-creator-45b7c5ac293a297ff1c6c7e64b24d662ec29b7b2.tar.gz
Revert "CppTools: Do not put configuration document into global snapshot and working copy"
This reverts commit 05942b63f8bad6d6787fea10c31f10458cdccd06 because it breaks refactoring, e.g. Q_PROPERTY generators. Change-Id: I9a14b912ba72663f08ea99e7e066d824b18da4b0 Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp2
-rw-r--r--src/plugins/cpptools/builtinindexingsupport.cpp1
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp14
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp11
-rw-r--r--src/plugins/cpptools/cpptoolstestcase.cpp5
-rw-r--r--src/plugins/designer/qtcreatorintegration.cpp5
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.cpp2
7 files changed, 29 insertions, 11 deletions
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp
index 019b0632b5..7635e6918a 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp
@@ -382,6 +382,8 @@ static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QVector<ProjectPart::Pt
continue;
foreach (const ProjectFile &file, projectPart->files) {
+ if (file.path == CppModelManager::configurationFileName())
+ continue;
QTC_CHECK(file.kind != ProjectFile::Unclassified);
QTC_CHECK(file.kind != ProjectFile::Unsupported);
if (ProjectFile::isSource(file.kind)) {
diff --git a/src/plugins/cpptools/builtinindexingsupport.cpp b/src/plugins/cpptools/builtinindexingsupport.cpp
index eadcda99bd..d51ba79e1a 100644
--- a/src/plugins/cpptools/builtinindexingsupport.cpp
+++ b/src/plugins/cpptools/builtinindexingsupport.cpp
@@ -357,7 +357,6 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(
params.indexerFileSizeLimitInMb = indexerFileSizeLimitInMb();
params.headerPaths = mgr->headerPaths();
params.workingCopy = mgr->workingCopy();
- params.workingCopy.insert(mgr->configurationFileName(), mgr->definedMacros());
params.sourceFiles = sourceFiles;
QFuture<void> result = Utils::runAsync(mgr->sharedThreadPool(), parse, superFuture, params);
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index 4cb5ce107e..d8a197b45a 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -594,6 +594,11 @@ WorkingCopy CppModelManager::buildWorkingCopyList()
workingCopy.insert(es->fileName(), es->contents(), es->revision());
}
+ // Add the project configuration file
+ QByteArray conf = codeModelConfiguration();
+ conf += definedMacros();
+ workingCopy.insert(configurationFileName(), conf);
+
return workingCopy;
}
@@ -871,6 +876,12 @@ QFuture<void> CppModelManager::updateProjectInfo(QFutureInterface<void> &futureI
removeProjectInfoFilesAndIncludesFromSnapshot(oldProjectInfo);
filesToReindex.unite(newSourceFiles);
+ // The "configuration file" includes all defines and therefore should be updated
+ if (comparer.definesChanged()) {
+ QMutexLocker snapshotLocker(&d->m_snapshotMutex);
+ d->m_snapshot.remove(configurationFileName());
+ }
+
// Otherwise check for added and modified files
} else {
const QSet<QString> addedFiles = comparer.addedFiles();
@@ -999,9 +1010,6 @@ bool CppModelManager::isClangCodeModelActive() const
void CppModelManager::emitDocumentUpdated(Document::Ptr doc)
{
- if (Client::isInjectedFile(doc->fileName()))
- return;
-
if (replaceDocument(doc))
emit documentUpdated(doc);
}
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index 79ce311dbc..35f9931f21 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -618,7 +618,7 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
CppModelManager *mm = CppModelManager::instance();
WorkingCopy workingCopy = mm->workingCopy();
- QCOMPARE(workingCopy.size(), 1);
+ QCOMPARE(workingCopy.size(), 2); // mm->configurationFileName() and "ui_*.h"
QStringList fileNamesInWorkinCopy;
QHashIterator<Utils::FileName, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
@@ -628,7 +628,8 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
}
fileNamesInWorkinCopy.sort();
const QString expectedUiHeaderFileName = _("ui_mainwindow.h");
- QCOMPARE(fileNamesInWorkinCopy.at(0), expectedUiHeaderFileName);
+ QCOMPARE(fileNamesInWorkinCopy.at(0), mm->configurationFileName());
+ QCOMPARE(fileNamesInWorkinCopy.at(1), expectedUiHeaderFileName);
// Check CppSourceProcessor / includes.
// The CppSourceProcessor is expected to find the ui_* file in the working copy.
@@ -777,7 +778,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
pi.appendProjectPart(part2);
helper.updateProjectInfo(pi);
- QCOMPARE(mm->snapshot().size(), 3);
+ QCOMPARE(mm->snapshot().size(), 4);
// Open a file in the editor
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0);
@@ -845,7 +846,7 @@ void CppToolsPlugin::test_modelmanager_precompiled_headers()
pi.appendProjectPart(part2);
helper.updateProjectInfo(pi);
- QCOMPARE(mm->snapshot().size(), 3);
+ QCOMPARE(mm->snapshot().size(), 4);
// Open a file in the editor
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0);
@@ -925,7 +926,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
helper.updateProjectInfo(pi);
- QCOMPARE(mm->snapshot().size(), 3);
+ QCOMPARE(mm->snapshot().size(), 4);
// Open a file in the editor
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0);
diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp
index eb7235b7f7..43ed514efe 100644
--- a/src/plugins/cpptools/cpptoolstestcase.cpp
+++ b/src/plugins/cpptools/cpptoolstestcase.cpp
@@ -423,8 +423,11 @@ bool VerifyCleanCppModelManager::isClean(bool testOnlyForCleanedProjects)
RETURN_FALSE_IF_NOT(mm->headerPaths().isEmpty());
RETURN_FALSE_IF_NOT(mm->definedMacros().isEmpty());
RETURN_FALSE_IF_NOT(mm->projectFiles().isEmpty());
- if (!testOnlyForCleanedProjects)
+ if (!testOnlyForCleanedProjects) {
RETURN_FALSE_IF_NOT(mm->snapshot().isEmpty());
+ RETURN_FALSE_IF_NOT(mm->workingCopy().size() == 1);
+ RETURN_FALSE_IF_NOT(mm->workingCopy().contains(mm->configurationFileName()));
+ }
return true;
}
diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp
index 5fb47eec52..1f6bd925b7 100644
--- a/src/plugins/designer/qtcreatorintegration.cpp
+++ b/src/plugins/designer/qtcreatorintegration.cpp
@@ -525,11 +525,14 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
} else {
const CppTools::WorkingCopy workingCopy =
CppTools::CppModelManager::instance()->workingCopy();
+ const Utils::FileName configFileName =
+ Utils::FileName::fromString(CppTools::CppModelManager::configurationFileName());
QHashIterator<Utils::FileName, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
while (it.hasNext()) {
it.next();
const Utils::FileName &fileName = it.key();
- newDocTable.insert(docTable.document(fileName));
+ if (fileName != configFileName)
+ newDocTable.insert(docTable.document(fileName));
}
}
docTable = newDocTable;
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index 9cb603f1ce..df25d302d8 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -43,6 +43,7 @@
#include <cpptools/projectinfo.h>
#include <cpptools/projectpartheaderpath.h>
#include <cpptools/cppprojectupdater.h>
+#include <cpptools/cppmodelmanager.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildtargetinfo.h>
@@ -424,6 +425,7 @@ void QmakeProject::updateCppCodeModel()
});
}
generators.append(proGenerators);
+ fileList.prepend(CppTools::CppModelManager::configurationFileName());
rpp.setFiles(fileList);
rpps.append(rpp);