summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/moc.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-06-24 02:04:09 +0200
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2016-02-10 16:00:46 +0000
commitcc2938b5b6aa07210b04bd48ad8a2830701a06e5 (patch)
tree5e9719c9eace2947e542f2ee34c0f23589e3e7e6 /src/tools/moc/moc.cpp
parent3e63a58a96bc9d7fc6004f3a8eacc062bae953f9 (diff)
moc: replace inefficient QLists with QVectors
These types are larger than a void*, so holding them in QLists is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Fix by marking them movable, and holding them in a QVector instead. Change-Id: I42f494ed87854eadc33d78db4479203ff5e0370f Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/tools/moc/moc.cpp')
-rw-r--r--src/tools/moc/moc.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 54a0871bec..0e689bd5c1 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -538,7 +538,7 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
void Moc::parse()
{
- QList<NamespaceDef> namespaceList;
+ QVector<NamespaceDef> namespaceList;
bool templateClass = false;
while (hasNext()) {
Token t = next();
@@ -801,7 +801,7 @@ void Moc::parse()
}
}
-static bool any_type_contains(const QList<PropertyDef> &properties, const QByteArray &pattern)
+static bool any_type_contains(const QVector<PropertyDef> &properties, const QByteArray &pattern)
{
for (const auto &p : properties) {
if (p.type.contains(pattern))
@@ -810,7 +810,7 @@ static bool any_type_contains(const QList<PropertyDef> &properties, const QByteA
return false;
}
-static bool any_arg_contains(const QList<FunctionDef> &functions, const QByteArray &pattern)
+static bool any_arg_contains(const QVector<FunctionDef> &functions, const QByteArray &pattern)
{
for (const auto &f : functions) {
for (const auto &arg : f.arguments) {
@@ -835,7 +835,7 @@ static QByteArrayList make_candidates()
return result;
}
-static QByteArrayList requiredQtContainers(const QList<ClassDef> &classes)
+static QByteArrayList requiredQtContainers(const QVector<ClassDef> &classes)
{
static const QByteArrayList candidates = make_candidates();
@@ -1319,7 +1319,7 @@ void Moc::parseInterfaces(ClassDef *def)
{
next(LPAREN);
while (test(IDENTIFIER)) {
- QList<ClassDef::Interface> iface;
+ QVector<ClassDef::Interface> iface;
iface += ClassDef::Interface(lexem());
while (test(SCOPE)) {
iface.last().className += lexem();