CppTools: Save some stats by using correct include paths

..while initial parsing.

Change-Id: I202da3f4f9e445a28e9726352fc005488efe2893
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2014-03-10 15:22:46 -03:00
parent 7c0bb193d8
commit 60f9046d5b
2 changed files with 8 additions and 0 deletions

View File

@@ -47,6 +47,8 @@ static void parse(QFutureInterface<void> &future,
const QString conf = CppModelManagerInterface::configurationFileName();
bool processingHeaders = false;
CppModelManager *cmm = CppModelManager::instance();
const QStringList fallbackIncludePaths = cmm->includePaths();
for (int i = 0; i < files.size(); ++i) {
if (future.isPaused())
future.waitForResume();
@@ -65,6 +67,11 @@ static void parse(QFutureInterface<void> &future,
processingHeaders = true;
}
QList<ProjectPart::Ptr> parts = cmm->projectPart(fileName);
QStringList includePaths = parts.isEmpty()
? fallbackIncludePaths
: parts.first()->includePaths;
preproc->setIncludePaths(includePaths);
preproc->run(fileName);
future.setProgressValue(files.size() - preproc->todo().size());

View File

@@ -802,6 +802,7 @@ ProjectPart::Ptr CppModelManager::projectPartForProjectFile(const QString &proje
QList<ProjectPart::Ptr> CppModelManager::projectPart(const QString &fileName) const
{
QMutexLocker locker(&m_projectMutex);
return m_fileToProjectParts.value(fileName);
}