summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-10-08 10:05:06 +0200
committerMarc Mutz <marc.mutz@kdab.com>2014-10-09 09:41:40 +0200
commit05663e29d047851adb9a1ef440fb78b38ff3cc9b (patch)
tree4a796dfa9910f0483150e0e25f007d8d1a664382
parent4a2cf9ca4174ee9879bfc5858f10dacc028a521f (diff)
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 <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
-rw-r--r--src/tools/moc/generator.cpp14
1 files changed, 7 insertions, 7 deletions
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<FunctionDef>& 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();