From 50e496bd3ac71ccebc99c0a429b41fb0e7864ac2 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Aug 2019 15:01:49 +0200 Subject: Do not use QList QMakeLocalFileName is not suitable for QList. Use QVector instead. Change-Id: I5a3c4c8da14c0a920b5a57cba148ad68ac0f85a2 Reviewed-by: Edward Welbourne --- qmake/generators/makefile.cpp | 6 +++--- qmake/generators/makefiledeps.cpp | 8 ++++---- qmake/generators/makefiledeps.h | 7 ++++--- qmake/generators/projectgenerator.cpp | 2 +- qmake/generators/unix/unixmake.cpp | 7 +++---- qmake/generators/win32/winmakefile.cpp | 8 +++----- 6 files changed, 18 insertions(+), 20 deletions(-) (limited to 'qmake/generators') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 59cae332d8..ec73ccfe54 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -764,7 +764,7 @@ MakefileGenerator::init() ProStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"]; if(project->isActiveConfig("depend_includepath")) incDirs += v["INCLUDEPATH"]; - QList deplist; + QVector deplist; deplist.reserve(incDirs.size()); for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it) deplist.append(QMakeLocalFileName((*it).toQString())); @@ -1839,7 +1839,7 @@ static QStringList splitDeps(const QString &indeps, bool lineMode) QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString &file) { - const QList &depdirs = QMakeSourceFileInfo::dependencyPaths(); + const QVector &depdirs = QMakeSourceFileInfo::dependencyPaths(); for (const auto &depdir : depdirs) { const QString &local = depdir.local(); QString lf = outDir.absoluteFilePath(local + '/' + file); @@ -3105,7 +3105,7 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca if(Option::output_dir != qmake_getpwd() && QDir::isRelativePath(dep.real())) { //is it from the shadow tree - QList depdirs = QMakeSourceFileInfo::dependencyPaths(); + QVector depdirs = QMakeSourceFileInfo::dependencyPaths(); depdirs.prepend(fileInfo(file.real()).absoluteDir().path()); QString pwd = qmake_getpwd(); if(pwd.at(pwd.length()-1) != '/') diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 69a3217723..10fcc1493c 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -199,10 +199,10 @@ void QMakeSourceFileInfo::dependTreeWalker(SourceFile *node, SourceDependChildre } } -void QMakeSourceFileInfo::setDependencyPaths(const QList &l) +void QMakeSourceFileInfo::setDependencyPaths(const QVector &l) { // Ensure that depdirs does not contain the same paths several times, to minimize the stats - QList ll; + QVector ll; for (int i = 0; i < l.count(); ++i) { if (!ll.contains(l.at(i))) ll.append(l.at(i)); @@ -853,8 +853,8 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) } } if(!exists) { //path lookup - for(QList::Iterator it = depdirs.begin(); it != depdirs.end(); ++it) { - QMakeLocalFileName f((*it).real() + Option::dir_sep + lfn.real()); + for (const QMakeLocalFileName &depdir : qAsConst(depdirs)) { + QMakeLocalFileName f(depdir.real() + Option::dir_sep + lfn.real()); QFileInfo fi(findFileInfo(f)); if(fi.exists() && !fi.isDir()) { lfn = fixPathForFile(f); diff --git a/qmake/generators/makefiledeps.h b/qmake/generators/makefiledeps.h index 89ada9ed49..b91a3e0a0f 100644 --- a/qmake/generators/makefiledeps.h +++ b/qmake/generators/makefiledeps.h @@ -33,6 +33,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -65,7 +66,7 @@ private: //quick project lookups SourceFiles *files, *includes; bool files_changed; - QList depdirs; + QVector depdirs; QStringList systemIncludes; //sleezy buffer code @@ -91,8 +92,8 @@ public: QMakeSourceFileInfo(const QString &cachefile=""); virtual ~QMakeSourceFileInfo(); - QList dependencyPaths() const { return depdirs; } - void setDependencyPaths(const QList &); + QVector dependencyPaths() const { return depdirs; } + void setDependencyPaths(const QVector &); enum DependencyMode { Recursive, NonRecursive }; inline void setDependencyMode(DependencyMode mode) { dep_mode = mode; } diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index 119dd652b3..c43f6b4e4a 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -215,7 +215,7 @@ ProjectGenerator::init() } //setup deplist - QList deplist; + QVector deplist; { const ProStringList &d = v["DEPENDPATH"]; for(int i = 0; i < d.size(); ++i) diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 227dc8908a..664c81296c 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -392,7 +392,7 @@ UnixMakefileGenerator::fixLibFlag(const ProString &lib) bool UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) { - QList libdirs, frameworkdirs; + QVector libdirs, frameworkdirs; int libidx = 0, fwidx = 0; for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS")) libdirs.append(QMakeLocalFileName(dlib.toQString())); @@ -418,9 +418,8 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) libdirs.insert(libidx++, f); } else if(opt.startsWith("-l")) { QString lib = opt.mid(2); - for (QList::Iterator dep_it = libdirs.begin(); - dep_it != libdirs.end(); ++dep_it) { - QString libBase = (*dep_it).local() + '/' + for (const QMakeLocalFileName &libdir : qAsConst(libdirs)) { + QString libBase = libdir.local() + '/' + project->first("QMAKE_PREFIX_SHLIB") + lib; if (linkPrl && processPrlFile(libBase, true)) goto found; diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 613a5a6a89..392d825f5b 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -79,7 +79,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) ProStringList impexts = project->values("QMAKE_LIB_EXTENSIONS"); if (impexts.isEmpty()) impexts = project->values("QMAKE_EXTENSION_STATICLIB"); - QList dirs; + QVector dirs; int libidx = 0; for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS")) dirs.append(QMakeLocalFileName(dlib.toQString())); @@ -104,8 +104,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) QString lib = arg.toQString(); ProString verovr = project->first(ProKey("QMAKE_" + lib.toUpper() + "_VERSION_OVERRIDE")); - for (QList::Iterator dir_it = dirs.begin(); - dir_it != dirs.end(); ++dir_it) { + for (auto dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { QString cand = (*dir_it).real() + Option::dir_sep + lib; if (linkPrl && processPrlFile(cand, true)) { (*it) = cand; @@ -128,8 +127,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) if (processPrlFile(lib, false)) (*it) = lib; } else { - for (QList::Iterator dir_it = dirs.begin(); - dir_it != dirs.end(); ++dir_it) { + for (auto dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { QString cand = (*dir_it).real() + Option::dir_sep + lib; if (processPrlFile(cand, false)) { (*it) = cand; -- cgit v1.2.3