aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-12-02 10:18:34 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-12-02 13:06:27 +0100
commitd6fb8791ab8734455398ac556fd035dc08a1a0a6 (patch)
tree05fc627383415f4fed090f078201b3678c2453ec /src/qmlcompiler
parent8a555cc22afb93dbe0e0da83f211c6e4f032bd09 (diff)
Let AOT-compiled functions modify their arguments
It allows for more natural looking generated code and there is no downside. The arguments are specially prepared for the call anyway. Change-Id: I8437e93adb1c67db1b53fbdb29cbea10f6ef278f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler')
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index 0990e0c896..bf4dc55b6d 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -464,8 +464,8 @@ bool qSaveQmlJSUnitAsCpp(const QString &inputFileName, const QString &outputFile
writeStr("extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[] = { { 0, QMetaType::fromType<void>(), {}, nullptr } };");
} else {
writeStr(R"(template <typename Binding>
- void wrapCall(QQmlContext *context, QObject *scopeObject, void *dataPtr, const void **argumentsPtr, Binding &&binding) {
- using return_type = std::invoke_result_t<Binding, QQmlContext*, QObject*, const void **>;
+ void wrapCall(QQmlContext *context, QObject *scopeObject, void *dataPtr, void **argumentsPtr, Binding &&binding) {
+ using return_type = std::invoke_result_t<Binding, QQmlContext*, QObject*, void **>;
if constexpr (std::is_same_v<return_type, void>) {
Q_UNUSED(dataPtr);
binding(context, scopeObject, argumentsPtr);
@@ -476,8 +476,8 @@ bool qSaveQmlJSUnitAsCpp(const QString &inputFileName, const QString &outputFile
writeStr("extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[] = {");
- QString header = QStringLiteral("[](QQmlContext *context, QObject *scopeObject, void *dataPtr, const void **argumentsPtr) {\n");
- header += QStringLiteral("wrapCall(context, scopeObject, dataPtr, argumentsPtr, [](QQmlContext *context, QObject *scopeObject, const void **argumentsPtr) {");
+ QString header = QStringLiteral("[](QQmlContext *context, QObject *scopeObject, void *dataPtr, void **argumentsPtr) {\n");
+ header += QStringLiteral("wrapCall(context, scopeObject, dataPtr, argumentsPtr, [](QQmlContext *context, QObject *scopeObject, void **argumentsPtr) {");
header += QStringLiteral("Q_UNUSED(context); Q_UNUSED(scopeObject); Q_UNUSED(argumentsPtr);\n");
QString footer = QStringLiteral("});}\n");