forked from qt-creator/qt-creator
C++: update project info once after finishing adding all project parts.
So that recalculating the information is not O(n^2) but linear. Change-Id: I69903e0b5ad321d071804d782ad634a3f300e71a Reviewed-by: Daniel Teske <daniel.teske@digia.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
9c1f44e942
commit
7290c43da1
@@ -166,35 +166,36 @@ const QList<ProjectPart::Ptr> ProjectInfo::projectParts() const
|
||||
|
||||
void ProjectInfo::appendProjectPart(const ProjectPart::Ptr &part)
|
||||
{
|
||||
if (!part)
|
||||
return;
|
||||
|
||||
m_projectParts.append(part);
|
||||
if (part)
|
||||
m_projectParts.append(part);
|
||||
}
|
||||
|
||||
void ProjectInfo::finish()
|
||||
{
|
||||
typedef ProjectPart::HeaderPath HeaderPath;
|
||||
|
||||
// Update header paths
|
||||
QSet<HeaderPath> incs = QSet<HeaderPath>::fromList(m_headerPaths);
|
||||
foreach (const HeaderPath &hp, part->headerPaths) {
|
||||
if (!incs.contains(hp)) {
|
||||
incs.insert(hp);
|
||||
m_headerPaths += hp;
|
||||
QSet<HeaderPath> incs;
|
||||
foreach (const ProjectPart::Ptr &part, m_projectParts) {
|
||||
// Update header paths
|
||||
foreach (const HeaderPath &hp, part->headerPaths) {
|
||||
if (!incs.contains(hp)) {
|
||||
incs.insert(hp);
|
||||
m_headerPaths += hp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update source files
|
||||
foreach (const ProjectFile &file, part->files)
|
||||
m_sourceFiles.insert(file.path);
|
||||
// Update source files
|
||||
foreach (const ProjectFile &file, part->files)
|
||||
m_sourceFiles.insert(file.path);
|
||||
|
||||
// Update defines
|
||||
if (!m_defines.isEmpty())
|
||||
m_defines.append('\n');
|
||||
m_defines.append(part->toolchainDefines);
|
||||
m_defines.append(part->projectDefines);
|
||||
if (!part->projectConfigFile.isEmpty()) {
|
||||
m_defines.append('\n');
|
||||
m_defines += ProjectPart::readProjectConfigFile(part);
|
||||
m_defines.append('\n');
|
||||
// Update defines
|
||||
m_defines.append(part->toolchainDefines);
|
||||
m_defines.append(part->projectDefines);
|
||||
if (!part->projectConfigFile.isEmpty()) {
|
||||
m_defines.append('\n');
|
||||
m_defines += ProjectPart::readProjectConfigFile(part);
|
||||
m_defines.append('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user