Disable the indexer when m_indexerEnabled is false.

This commit is contained in:
Roberto Raggi
2009-12-07 12:03:31 +01:00
parent 3fb1bc46ae
commit 15ee71b324
2 changed files with 5 additions and 4 deletions

View File

@@ -591,8 +591,6 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
return previousDoc; return previousDoc;
} }
void CppTools::CppModelManagerInterface::updateModifiedSourceFiles() void CppTools::CppModelManagerInterface::updateModifiedSourceFiles()
{ {
const Snapshot snapshot = this->snapshot(); const Snapshot snapshot = this->snapshot();
@@ -633,6 +631,7 @@ CppModelManager::CppModelManager(QObject *parent)
: CppModelManagerInterface(parent) : CppModelManagerInterface(parent)
{ {
m_findReferences = new CppFindReferences(this); m_findReferences = new CppFindReferences(this);
m_indexerEnabled = qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull();
m_revision = 0; m_revision = 0;
m_synchronizer.setCancelOnWait(true); m_synchronizer.setCancelOnWait(true);
@@ -848,7 +847,7 @@ void CppModelManager::updateProjectInfo(const ProjectInfo &pinfo)
m_projects.insert(pinfo.project, pinfo); m_projects.insert(pinfo.project, pinfo);
m_dirty = true; m_dirty = true;
if (qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { if (m_indexerEnabled) {
QFuture<void> result = QtConcurrent::run(&CppModelManager::updateIncludesInPaths, QFuture<void> result = QtConcurrent::run(&CppModelManager::updateIncludesInPaths,
this, this,
pinfo.includePaths, pinfo.includePaths,
@@ -870,7 +869,7 @@ QStringList CppModelManager::includesInPath(const QString &path) const
QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles) QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles)
{ {
if (! sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { if (! sourceFiles.isEmpty() && m_indexerEnabled) {
const QMap<QString, QString> workingCopy = buildWorkingCopyList(); const QMap<QString, QString> workingCopy = buildWorkingCopyList();
CppPreprocessor *preproc = new CppPreprocessor(this); CppPreprocessor *preproc = new CppPreprocessor(this);
@@ -900,6 +899,7 @@ QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles
m_core->progressManager()->addTask(result, tr("Indexing"), m_core->progressManager()->addTask(result, tr("Indexing"),
CppTools::Constants::TASK_INDEX); CppTools::Constants::TASK_INDEX);
} }
return result; return result;
} }
return QFuture<void>(); return QFuture<void>();

View File

@@ -217,6 +217,7 @@ private:
unsigned m_revision; unsigned m_revision;
CppFindReferences *m_findReferences; CppFindReferences *m_findReferences;
bool m_indexerEnabled;
}; };
} // namespace Internal } // namespace Internal