Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmljscompiler.cpp File Reference
#include "qqmljscompiler_p.h"
#include <private/qqmlirbuilder_p.h>
#include <private/qqmljsbasicblocks_p.h>
#include <private/qqmljscodegenerator_p.h>
#include <private/qqmljsfunctioninitializer_p.h>
#include <private/qqmljsimportvisitor_p.h>
#include <private/qqmljslexer_p.h>
#include <private/qqmljsloadergenerator_p.h>
#include <private/qqmljsparser_p.h>
#include <private/qqmljsshadowcheck_p.h>
#include <private/qqmljsstoragegeneralizer_p.h>
#include <private/qqmljstypepropagator_p.h>
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qloggingcategory.h>
#include <limits>
+ Include dependency graph for qqmljscompiler.cpp:

Go to the source code of this file.

Classes

class  BindingOrFunction
 

Functions

 Q_LOGGING_CATEGORY (lcAotCompiler, "qt.qml.compiler.aot", QtFatalMsg)
 
static QSet< QStringgetIllegalNames ()
 
 Q_GLOBAL_STATIC_WITH_ARGS (QSet< QString >, illegalNames,(getIllegalNames()))
 
static QString diagnosticErrorMessage (const QString &fileName, const QQmlJS::DiagnosticMessage &m)
 
static void annotateListElements (QmlIR::Document *document)
 
static bool checkArgumentsObjectUseInSignalHandlers (const QmlIR::Document &doc, QQmlJSCompileError *error)
 
bool qCompileQmlFile (const QString &inputFileName, QQmlJSSaveFunction saveFunction, QQmlJSAotCompiler *aotCompiler, QQmlJSCompileError *error, bool storeSourceLocation, QV4::Compiler::CodegenWarningInterface *interface, const QString *fileContents)
 
bool qCompileQmlFile (QmlIR::Document &irDocument, const QString &inputFileName, QQmlJSSaveFunction saveFunction, QQmlJSAotCompiler *aotCompiler, QQmlJSCompileError *error, bool storeSourceLocation, QV4::Compiler::CodegenWarningInterface *interface, const QString *fileContents)
 
bool qCompileJSFile (const QString &inputFileName, const QString &inputFileUrl, QQmlJSSaveFunction saveFunction, QQmlJSCompileError *error)
 
bool qSaveQmlJSUnitAsCpp (const QString &inputFileName, const QString &outputFileName, const QV4::CompiledData::SaveableUnitPointer &unit, const QQmlJSAotFunctionMap &aotFunctions, QString *errorString)
 
static bool isStrict (const QmlIR::Document *doc)
 

Variables

static const int FileScopeCodeIndex = -1
 
static const char * wrapCallCode
 
static const char * funcHeaderCode
 

Function Documentation

◆ annotateListElements()

static void annotateListElements ( QmlIR::Document document)
static

Definition at line 86 of file qqmljscompiler.cpp.

References QString::isEmpty(), QmlIR::Binding::next, QString::prepend(), QStringLiteral, and QV4::CompiledData::Binding::Type_Script.

Referenced by qCompileQmlFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkArgumentsObjectUseInSignalHandlers()

static bool checkArgumentsObjectUseInSignalHandlers ( const QmlIR::Document doc,
QQmlJSCompileError error 
)
static

Definition at line 118 of file qqmljscompiler.cpp.

References QV4::Compiler::Context::ArgumentsObjectUsed, QString::at(), error, QV4::Compiler::Module::functions, QChar::isUpper(), QmlIR::Document::jsModule, QString::number(), QmlIR::Document::objects, QString::size(), QString::startsWith(), QmlIR::Document::stringAt(), and QV4::CompiledData::Binding::Type_Script.

Referenced by qCompileQmlFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ diagnosticErrorMessage()

static QString diagnosticErrorMessage ( const QString fileName,
const QQmlJS::DiagnosticMessage m 
)
static

Definition at line 55 of file qqmljscompiler.cpp.

References fileName, and QString::number().

Referenced by QQmlJSCompileError::appendDiagnostic(), and qCompileQmlFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIllegalNames()

static QSet< QString > getIllegalNames ( )
static

Definition at line 32 of file qqmljscompiler.cpp.

References QString::fromLatin1(), QSet< T >::insert(), and QV4::Compiler::Codegen::s_globalNames.

+ Here is the call graph for this function:

◆ isStrict()

static bool isStrict ( const QmlIR::Document doc)
static

Definition at line 666 of file qqmljscompiler.cpp.

References QmlIR::Document::pragmas, and QmlIR::Pragma::Strict.

Referenced by QQmlJSAotCompiler::diagnose(), and QV4::EvalFunction::evalCall().

+ Here is the caller graph for this function:

◆ Q_GLOBAL_STATIC_WITH_ARGS()

Q_GLOBAL_STATIC_WITH_ARGS ( QSet< QString ,
illegalNames  ,
(getIllegalNames())   
)

◆ Q_LOGGING_CATEGORY()

Q_LOGGING_CATEGORY ( lcAotCompiler  ,
"qt.qml.compiler.aot"  ,
QtFatalMsg   
)

◆ qCompileJSFile()

◆ qCompileQmlFile() [1/2]

bool qCompileQmlFile ( const QString inputFileName,
QQmlJSSaveFunction  saveFunction,
QQmlJSAotCompiler aotCompiler,
QQmlJSCompileError error,
bool  storeSourceLocation,
QV4::Compiler::CodegenWarningInterface interface,
const QString fileContents 
)

Definition at line 180 of file qqmljscompiler.cpp.

References error, interface, and qCompileQmlFile().

Referenced by QQmlJSLinter::lintFile(), and qCompileQmlFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qCompileQmlFile() [2/2]

◆ qSaveQmlJSUnitAsCpp()

bool qSaveQmlJSUnitAsCpp ( const QString inputFileName,
const QString outputFileName,
const QV4::CompiledData::SaveableUnitPointer unit,
const QQmlJSAotFunctionMap aotFunctions,
QString errorString 
)

Variable Documentation

◆ FileScopeCodeIndex

const int FileScopeCodeIndex = -1
static

Definition at line 30 of file qqmljscompiler.cpp.

Referenced by qCompileQmlFile(), and qSaveQmlJSUnitAsCpp().

◆ funcHeaderCode

const char* funcHeaderCode
static
Initial value:
= R"(
[](const QQmlPrivate::AOTCompiledContext *context, void *data, void **argv) {
wrapCall(context, data, argv, [](const QQmlPrivate::AOTCompiledContext *aotContext, void **argumentsPtr) {
Q_UNUSED(aotContext)
Q_UNUSED(argumentsPtr)
)"

Definition at line 479 of file qqmljscompiler.cpp.

Referenced by qSaveQmlJSUnitAsCpp().

◆ wrapCallCode

const char* wrapCallCode
static
Initial value:
= R"(
template <typename Binding>
void wrapCall(const QQmlPrivate::AOTCompiledContext *aotContext, void *dataPtr, void **argumentsPtr, Binding &&binding)
{
using return_type = std::invoke_result_t<Binding, const QQmlPrivate::AOTCompiledContext *, void **>;
if constexpr (std::is_same_v<return_type, void>) {
Q_UNUSED(dataPtr)
binding(aotContext, argumentsPtr);
} else {
if (dataPtr) {
new (dataPtr) return_type(binding(aotContext, argumentsPtr));
} else {
binding(aotContext, argumentsPtr);
}
}
}
)"

Definition at line 461 of file qqmljscompiler.cpp.

Referenced by qSaveQmlJSUnitAsCpp().