C++: introduce a project config file field in the projectPart.

This field is used by the generic project manager which passes the
".config" file in it. The advantage is that both the SnapshotUpdater and
the clang code model do not need to do anything smart, but can pass it
directly to the preprocessor.

Task-number: QTCREATORBUG-11390
Change-Id: I44fc7b20afd28fb59608412f2cce86af6f7e7d6b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2014-02-05 16:44:35 +01:00
parent 36dccb42fa
commit 346e84d219
10 changed files with 62 additions and 26 deletions

View File

@@ -60,6 +60,7 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
QStringList includePaths;
QStringList frameworkPaths;
QStringList precompiledHeaders;
QString projectConfigFile;
updateProjectPart();
@@ -73,6 +74,7 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
configFile += m_projectPart->projectDefines;
includePaths = m_projectPart->includePaths;
frameworkPaths = m_projectPart->frameworkPaths;
projectConfigFile = m_projectPart->projectConfigFile;
if (m_usePrecompiledHeaders)
precompiledHeaders = m_projectPart->precompiledHeaders;
}
@@ -99,6 +101,11 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
invalidateSnapshot = true;
}
if (projectConfigFile != m_projectConfigFile) {
m_projectConfigFile = projectConfigFile;
invalidateSnapshot = true;
}
if (precompiledHeaders != m_precompiledHeaders) {
m_precompiledHeaders = precompiledHeaders;
invalidateSnapshot = true;
@@ -160,6 +167,8 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
preproc.setIncludePaths(m_includePaths);
preproc.setFrameworkPaths(m_frameworkPaths);
preproc.run(configurationFileName);
if (!m_projectConfigFile.isEmpty())
preproc.run(m_projectConfigFile);
if (m_usePrecompiledHeaders) {
foreach (const QString &precompiledHeader, m_precompiledHeaders)
preproc.run(precompiledHeader);