From 05663e29d047851adb9a1ef440fb78b38ff3cc9b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 8 Oct 2014 10:05:06 +0200 Subject: moc: don't use QByteArrayLiteral The byte array literals are only used to append them to another QByteArray, so they offer only the static size calculation as a benefit. However, there are several drawbacks: - QByteArrayLiteral data cannot be shared the way string literals can be, not even within a single TU, and they add a few ints for the QByteArrayData header which cannot reside in BSS, but need to be stored in DATA. - QByteArrayLiteral *does* allocate when the compiler doesn't support C++11 lambdas. - QByteArrayLiteral, when not using RVO, litters the code with QByteArray dtor calls, which are not inline, and thus can't be optimized away. In particular, when used like this, they do not prevent any memory allocation (in fact, they might add some, absent lambdas). So, just append (C) string literals. Change-Id: Iee5dba8dd970c5cc6df116afc1f8709a62356b06 Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart --- src/tools/moc/generator.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/tools/moc') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 3592974b34..dd032e46f6 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -639,29 +639,29 @@ void Generator::generateFunctions(const QList& list, const char *fu unsigned char flags = type; if (f.access == FunctionDef::Private) { flags |= AccessPrivate; - comment.append(QByteArrayLiteral("Private")); + comment.append("Private"); } else if (f.access == FunctionDef::Public) { flags |= AccessPublic; - comment.append(QByteArrayLiteral("Public")); + comment.append("Public"); } else if (f.access == FunctionDef::Protected) { flags |= AccessProtected; - comment.append(QByteArrayLiteral("Protected")); + comment.append("Protected"); } if (f.isCompat) { flags |= MethodCompatibility; - comment.append(QByteArrayLiteral(" | MethodCompatibility")); + comment.append(" | MethodCompatibility"); } if (f.wasCloned) { flags |= MethodCloned; - comment.append(QByteArrayLiteral(" | MethodCloned")); + comment.append(" | MethodCloned"); } if (f.isScriptable) { flags |= MethodScriptable; - comment.append(QByteArrayLiteral(" | isScriptable")); + comment.append(" | isScriptable"); } if (f.revision > 0) { flags |= MethodRevisioned; - comment.append(QByteArrayLiteral(" | MethodRevisioned")); + comment.append(" | MethodRevisioned"); } int argc = f.arguments.count(); -- cgit v1.2.3