Avoid unnecessary string and list copies

Change-Id: I78bc4d307be69ce3bbfaa3ca3dd7c85e654af8d6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Yuri Vilmanis
2023-10-30 17:41:50 +10:30
parent 0a3bfc9323
commit 1acf00d3e1
4 changed files with 24 additions and 14 deletions

View File

@@ -38,7 +38,7 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc,
mergeEnvironment(i.key());
}
const QList<Document::Include> includes = doc->resolvedIncludes();
const QList<Document::Include> &includes = doc->resolvedIncludes();
for (const Document::Include &i : includes)
mergeEnvironment(i.resolvedFileName());
@@ -69,7 +69,7 @@ void FastPreprocessor::mergeEnvironment(const FilePath &filePath)
{
if (Utils::insert(_merged, filePath)) {
if (Document::Ptr doc = _snapshot.document(filePath)) {
const QList<Document::Include> includes = doc->resolvedIncludes();
const QList<Document::Include> &includes = doc->resolvedIncludes();
for (const Document::Include &i : includes)
mergeEnvironment(i.resolvedFileName());