diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-20 14:47:16 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-23 13:31:19 +0200 |
commit | db131539058aee18b65110fd2c42698e4894b05e (patch) | |
tree | 12614c4b3a69b3683f141c8df06a2528aebe3168 | |
parent | 2458f07eb568dc13f1f92b77adc047ef129a5636 (diff) |
qmlcachegen: Add empty AOT built functions to the loader
This enables us to use the same generateloader.cpp for qmlcachegen and
any replacement that actually produces AOT compiled functions.
Change-Id: I12fe81236e4ef16a627729c644d54b6c171b3860
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | src/qmlcompiler/qqmljsloadergenerator.cpp | 3 | ||||
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/qmlcompiler/qqmljsloadergenerator.cpp b/src/qmlcompiler/qqmljsloadergenerator.cpp index bd560e6266..829b33dabb 100644 --- a/src/qmlcompiler/qqmljsloadergenerator.cpp +++ b/src/qmlcompiler/qqmljsloadergenerator.cpp @@ -133,8 +133,9 @@ bool qQmlJSGenerateLoader(const QStringList &compiledFiles, const QString &outpu const QString ns = qQmlJSSymbolNamespaceForPath(compiledFile); stream << "namespace " << ns << " { \n"; stream << " extern const unsigned char qmlData[];\n"; + stream << " extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[];\n"; stream << " const QQmlPrivate::CachedQmlUnit unit = {\n"; - stream << " reinterpret_cast<const QV4::CompiledData::Unit*>(&qmlData), nullptr, nullptr\n"; + stream << " reinterpret_cast<const QV4::CompiledData::Unit*>(&qmlData), &aotBuiltFunctions[0], nullptr\n"; stream << " };\n"; stream << "}\n"; } diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index 33a77bc835..c3ac7d1542 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -386,6 +386,9 @@ static bool saveUnitAsCpp(const QString &inputFileName, const QString &outputFil if (!writeStr("\n")) return false; + if (!writeStr("#include <QtQml/qqmlprivate.h>\n")) + return false; + if (!writeStr(QByteArrayLiteral("namespace QmlCacheGeneratedCode {\nnamespace "))) return false; @@ -418,7 +421,14 @@ static bool saveUnitAsCpp(const QString &inputFileName, const QString &outputFil - if (!writeStr("};\n}\n}\n")) + if (!writeStr("};\n")) + return false; + + if (!writeStr("extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[] = " + "{ { 0, QMetaType::fromType<void>(), nullptr } };\n")) + return false; + + if (!writeStr("}\n}\n")) return false; #if QT_CONFIG(temporaryfile) |