diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-05-10 09:54:30 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-05-10 09:57:56 +0200 |
commit | 3e440ec21395fd8b128ba521b476a925d84e9408 (patch) | |
tree | b5e74fb006c2553d577d31b379158eb74be44449 /src/plugins/cpptools/cppmodelmanager.cpp | |
parent | 2e7e4fc92ef1799a26b1d9b5f5cac5330f804078 (diff) | |
download | qt-creator-3e440ec21395fd8b128ba521b476a925d84e9408.tar.gz |
Cache the resolved file names.
Diffstat (limited to 'src/plugins/cpptools/cppmodelmanager.cpp')
-rw-r--r-- | src/plugins/cpptools/cppmodelmanager.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index a88742112e..f4be14c6b0 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -398,6 +398,28 @@ bool CppPreprocessor::includeFile(const QString &absoluteFilePath, QString *resu QString CppPreprocessor::tryIncludeFile(QString &fileName, IncludeType type, unsigned *revision) { + if (type == IncludeGlobal) { + const QString fn = m_fileNameCache.value(fileName); + + if (! fn.isEmpty()) { + fileName = fn; + + if (revision) + *revision = 0; + + return QString(); + } + } + + const QString originalFileName = fileName; + const QString contents = tryIncludeFile_helper(fileName, type, revision); + if (type == IncludeGlobal) + m_fileNameCache.insert(originalFileName, fileName); + return contents; +} + +QString CppPreprocessor::tryIncludeFile_helper(QString &fileName, IncludeType type, unsigned *revision) +{ QFileInfo fileInfo(fileName); if (fileName == QLatin1String(pp_configuration_file) || fileInfo.isAbsolute()) { QString contents; @@ -1375,9 +1397,6 @@ void CppModelManager::parse(QFutureInterface<void> &future, if (future.isCanceled()) break; - // Change the priority of the background parser thread to idle. - QThread::currentThread()->setPriority(QThread::IdlePriority); - const QString fileName = files.at(i); const bool isSourceFile = i < sourceCount; @@ -1396,9 +1415,6 @@ void CppModelManager::parse(QFutureInterface<void> &future, if (isSourceFile) preproc->resetEnvironment(); - - // Restore the previous thread priority. - QThread::currentThread()->setPriority(QThread::NormalPriority); } future.setProgressValue(files.size()); |