From 0f3032f8403de34692edd5c12ed28b2ddfec777f Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 5 Aug 2014 11:34:52 +0200 Subject: CppTools: Tests: Add "Find Errors Indexing" mode Adding QTC_FIND_ERRORS_INDEXING=1 to the run environment will Creator force to do some "extended indexing" in order to find bugs: 1) The project files are parsed as if they would be opened in an editor. That is, parsing happens as precisely as possible, based on the ProjectPart information. 2) Symbols are looked up by invoking CheckSymbols, the backend of the semantic highlighter. 3) A "Task List File" (*.tasks) will be written with all diagnostic messages. This special indexing mode is meant for testing purposes. E.g. it can be run nightly on some bigger projects to find regressions. Note that Qt Creator will quit exactly after the first time some source files are indexed. E.g. that will happen if you open a file manually or if you open a new unconfigured project. Therefore it's required to configure projects as needed before invoking in this indexing mode. Change-Id: If25b83e67d24df9e28e107cb062f21cbf3b4c643 Reviewed-by: Erik Verbruggen --- src/plugins/cpptools/cppsnapshotupdater.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins/cpptools/cppsnapshotupdater.cpp') diff --git a/src/plugins/cpptools/cppsnapshotupdater.cpp b/src/plugins/cpptools/cppsnapshotupdater.cpp index a6900d3d2c..a534da4d57 100644 --- a/src/plugins/cpptools/cppsnapshotupdater.cpp +++ b/src/plugins/cpptools/cppsnapshotupdater.cpp @@ -42,6 +42,7 @@ SnapshotUpdater::SnapshotUpdater(const QString &fileInEditor) , m_editorDefinesChangedSinceLastUpdate(false) , m_usePrecompiledHeaders(false) , m_forceSnapshotInvalidation(false) + , m_releaseSourceAndAST(true) { } @@ -161,7 +162,8 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy) newRev = qMax(rev + 1, newRev); doc->setRevision(newRev); modelManager->emitDocumentUpdated(doc); - doc->releaseSourceAndAST(); + if (m_releaseSourceAndAST) + doc->releaseSourceAndAST(); }); Snapshot globalSnapshot = modelManager->snapshot(); globalSnapshot.remove(fileInEditor()); @@ -245,6 +247,12 @@ void SnapshotUpdater::setEditorDefines(const QByteArray &editorDefines) } } +void SnapshotUpdater::setReleaseSourceAndAST(bool onoff) +{ + QMutexLocker locker(&m_mutex); + m_releaseSourceAndAST = onoff; +} + void SnapshotUpdater::updateProjectPart() { if (m_manuallySetProjectPart) { -- cgit v1.2.1