Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qv4compileddata_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QV4COMPILEDDATA_P_H
4#define QV4COMPILEDDATA_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <functional>
18
19#include <QtCore/qhashfunctions.h>
20#include <QtCore/qstring.h>
21#include <QtCore/qscopeguard.h>
22#include <QtCore/qvector.h>
23#include <QtCore/qstringlist.h>
24#include <QtCore/qhash.h>
25#include <QtCore/qversionnumber.h>
26#include <QtCore/qlocale.h>
27
28#if QT_CONFIG(temporaryfile)
29#include <QtCore/qsavefile.h>
30#endif
31
32#include <private/qendian_p.h>
33#include <private/qv4staticvalue_p.h>
34#include <functional>
35#include <limits.h>
36
38
39// Bump this whenever the compiler data structures change in an incompatible way.
40//
41// IMPORTANT:
42//
43// Also change the comment behind the number to describe the latest change. This has the added
44// benefit that if another patch changes the version too, it will result in a merge conflict, and
45// not get removed silently.
46#define QV4_DATA_STRUCTURE_VERSION 0x3C // Restructured builtin type enums
47
48class QIODevice;
50class QQmlType;
51class QQmlEngine;
52
53namespace QQmlPrivate {
55}
56
57namespace QmlIR {
58struct Document;
59}
60
61namespace QV4 {
62namespace Heap {
63struct Module;
64struct String;
65struct InternalClass;
66};
67
68struct Function;
69class EvalISelFactory;
70
71namespace CompiledData {
72
73struct String;
74struct Function;
75struct Lookup;
76struct RegExp;
77struct Unit;
78
79template <typename ItemType, typename Container, const ItemType *(Container::*IndexedGetter)(int index) const>
81{
83 const Container *container;
84 int index;
85
86 const ItemType *operator->() { return (container->*IndexedGetter)(index); }
87 ItemType operator*() {return *operator->();}
88 void operator++() { ++index; }
89 bool operator==(const TableIterator &rhs) const { return index == rhs.index; }
90 bool operator!=(const TableIterator &rhs) const { return index != rhs.index; }
91};
92
94{
97 {
98 m_data.set<LineField>(l);
99 m_data.set<ColumnField>(c);
100 Q_ASSERT(m_data.get<LineField>() == l);
101 Q_ASSERT(m_data.get<ColumnField>() == c);
102 }
103
104 inline bool operator<(const Location &other) const {
105 return m_data.get<LineField>() < other.m_data.get<LineField>()
106 || (m_data.get<LineField>() == other.m_data.get<LineField>()
107 && m_data.get<ColumnField>() < other.m_data.get<ColumnField>());
108 }
109
110 friend size_t qHash(const Location &location, size_t seed = 0)
111 {
112 return QT_PREPEND_NAMESPACE(qHash)(location.m_data.data(), seed);
113 }
114
115 friend bool operator==(const Location &a, const Location &b)
116 {
117 return a.m_data.data()== b.m_data.data();
118 }
119
121 {
122 m_data.set<LineField>(line);
123 m_data.set<ColumnField>(column);
124 }
125
126 quint32 line() const { return m_data.get<LineField>(); }
127 quint32 column() const { return m_data.get<ColumnField>(); }
128
129private:
130 using LineField = quint32_le_bitfield_member<0, 20>;
131 using ColumnField = quint32_le_bitfield_member<20, 12>;
132
134};
135static_assert(sizeof(Location) == 4, "Location structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
136
137struct RegExp
138{
139 enum Flags : unsigned int {
145 RegExp_Sticky = 0x10
146 };
147
150 {
151 m_data.set<FlagsField>(flags);
152 m_data.set<StringIndexField>(stringIndex);
153 }
154
155 quint32 flags() const { return m_data.get<FlagsField>(); }
156 quint32 stringIndex() const { return m_data.get<StringIndexField>(); }
157
158private:
159 using FlagsField = quint32_le_bitfield_member<0, 5>;
160 using StringIndexField = quint32_le_bitfield_member<5, 27>;
162};
163static_assert(sizeof(RegExp) == 4, "RegExp structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
164
165struct Lookup
166{
167 enum Type : unsigned int {
172 };
173
174 enum Mode : unsigned int {
176 Mode_ForCall = 1
177 };
178
179 quint32 type() const { return m_data.get<TypeField>(); }
180 quint32 nameIndex() const { return m_data.get<NameIndexField>(); }
181 quint32 mode() const { return m_data.get<ModeField>(); }
182
185 {
186 m_data.set<TypeField>(type);
187 m_data.set<ModeField>(mode);
188 m_data.set<NameIndexField>(nameIndex);
189 }
190
191private:
192 using TypeField = quint32_le_bitfield_member<0, 2>;
193 using ModeField = quint32_le_bitfield_member<2, 1>;
194 // 1 bit left
195 using NameIndexField = quint32_le_bitfield_member<4, 28>;
197};
198static_assert(sizeof(Lookup) == 4, "Lookup structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
199
201{
203
205 {
206 m_data.set<NameOffsetField>(nameOffset);
207 m_data.set<IsAccessorField>(isAccessor ? 1 : 0);
208 }
209
210 quint32 nameOffset() const { return m_data.get<NameOffsetField>(); }
211 bool isAccessor() const { return m_data.get<IsAccessorField>() != 0; }
212
213private:
214 using NameOffsetField = quint32_le_bitfield_member<0, 31>;
215 using IsAccessorField = quint32_le_bitfield_member<31, 1>;
217};
218static_assert(sizeof(JSClassMember) == 4, "JSClassMember structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
219
221{
223 // JSClassMember[nMembers]
224
225 static int calculateSize(int nMembers) { return (sizeof(JSClass) + nMembers * sizeof(JSClassMember) + 7) & ~7; }
226};
227static_assert(sizeof(JSClass) == 4, "JSClass structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
228
229struct String
230{
232
233 static int calculateSize(const QString &str) {
234 // we cannot enconuter strings larger than INT_MAX anyway, as such a string
235 // would already break in other parts of the compilation process
236 return (sizeof(String) + (int(str.size()) + 1) * sizeof(quint16) + 7) & ~0x7;
237 }
238};
239
240static_assert (sizeof (String) == 4, "String structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
241
244 qint32_le line; // signed because debug instructions get negative line numbers
246};
247static_assert(sizeof(CodeOffsetToLineAndStatement) == 12, "CodeOffsetToLineAndStatement structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
248
249struct Block
250{
255
256 const quint32_le *localsTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + localsOffset); }
257
258 static int calculateSize(int nLocals) {
259 int trailingData = nLocals*sizeof (quint32);
260 size_t size = align(align(sizeof(Block)) + size_t(trailingData));
261 Q_ASSERT(size < INT_MAX);
262 return int(size);
263 }
264
265 static size_t align(size_t a) {
266 return (a + 7) & ~size_t(7);
267 }
268};
269static_assert(sizeof(Block) == 12, "Block structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
270
271enum class NamedBuiltin: unsigned int {
273};
274
275enum class CommonType : unsigned int {
276 // Actual named builtins
286
287 // Optimization for very common other types
288 Time, Date, Rect, Point, Size,
289
290 // No type specified or not recognized
291 Invalid
292};
293
295{
296 enum Flag {
297 NoFlag = 0x0,
298 Common = 0x1,
299 List = 0x2,
300 };
302
304 {
305 m_data.set<IsListField>(flags.testFlag(List) ? 1 : 0);
306 m_data.set<IndexIsCommonTypeField>(flags.testFlag(Common) ? 1 : 0);
308 }
309
310 bool indexIsCommonType() const
311 {
312 return m_data.get<IndexIsCommonTypeField>() != 0;
313 }
314
315 bool isList() const
316 {
317 return m_data.get<IsListField>() != 0;
318 }
319
321 {
322 return m_data.get<TypeNameIndexOrCommonTypeField>();
323 }
324
325private:
326 using IndexIsCommonTypeField = quint32_le_bitfield_member<0, 1>;
327 using IsListField = quint32_le_bitfield_member<1, 1>;
328 using TypeNameIndexOrCommonTypeField = quint32_le_bitfield_member<2, 30>;
330};
331static_assert(sizeof(ParameterType) == 4, "ParameterType structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
332
334{
337};
338static_assert(sizeof(Parameter) == 8, "Parameter structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
339
340// Function is aligned on an 8-byte boundary to make sure there are no bus errors or penalties
341// for unaligned access. The ordering of the fields is also from largest to smallest.
343{
344 enum Flags : unsigned int {
345 IsStrict = 0x1,
349 };
350
351 // Absolute offset into file where the code for this function is located.
354
358 quint32_le formalsOffset; // Can't turn this into a calculated offset because of the mutation in CompilationUnit::createUnitData.
363 size_t lineAndStatementNumberOffset() const { return localsOffset + nLocals * sizeof(quint32); }
364 quint32_le nestedFunctionIndex; // for functions that only return a single closure, used in signal handlers
365
369
373
374 size_t labelInfosOffset() const
375 {
377 }
378
379 // Keep all unaligned data at the end
382
383 // quint32 formalsIndex[nFormals]
384 // quint32 localsIndex[nLocals]
385
386 const Parameter *formalsTable() const
387 {
388 return reinterpret_cast<const Parameter *>(
389 reinterpret_cast<const char *>(this) + formalsOffset);
390 }
391 const quint32_le *localsTable() const
392 {
393 return reinterpret_cast<const quint32_le *>(
394 reinterpret_cast<const char *>(this) + localsOffset);
395 }
397 {
398 return reinterpret_cast<const CodeOffsetToLineAndStatement *>(
399 reinterpret_cast<const char *>(this) + lineAndStatementNumberOffset());
400 }
401
402 // --- QQmlPropertyCacheCreator interface
403 const Parameter *formalsBegin() const { return formalsTable(); }
404 const Parameter *formalsEnd() const { return formalsTable() + nFormals; }
405 // ---
406
407 const quint32_le *labelInfoTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + labelInfosOffset()); }
408
409 const char *code() const { return reinterpret_cast<const char *>(this) + codeOffset; }
410
411 static int calculateSize(
412 int nFormals, int nLocals, int nLinesAndStatements, int nInnerfunctions,
413 int labelInfoSize, int codeSize)
414 {
415 int trailingData = nFormals * sizeof(Parameter)
416 + (nLocals + nInnerfunctions + labelInfoSize) * sizeof (quint32)
417 + nLinesAndStatements * sizeof(CodeOffsetToLineAndStatement);
418 size_t size = align(align(sizeof(Function)) + size_t(trailingData)) + align(codeSize);
419 Q_ASSERT(size < INT_MAX);
420 return int(size);
421 }
422
423 static size_t align(size_t a) {
424 return (a + 7) & ~size_t(7);
425 }
426};
427static_assert(sizeof(Function) == 56, "Function structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
428
429struct Method {
430 enum Type {
433 Setter
434 };
435
439};
440static_assert(sizeof(Method) == 12, "Method structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
441
442struct Class
443{
450
451 const Method *methodTable() const { return reinterpret_cast<const Method *>(reinterpret_cast<const char *>(this) + methodTableOffset); }
452
453 static int calculateSize(int nStaticMethods, int nMethods) {
454 int trailingData = (nStaticMethods + nMethods) * sizeof(Method);
455 size_t size = align(sizeof(Class) + trailingData);
456 Q_ASSERT(size < INT_MAX);
457 return int(size);
458 }
459
460 static size_t align(size_t a) {
461 return (a + 7) & ~size_t(7);
462 }
463};
464static_assert(sizeof(Class) == 24, "Class structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
465
467{
469
470 static int calculateSize(int size) {
471 int trailingData = 2 * size * sizeof(quint32_le);
472 size_t s = align(sizeof(TemplateObject) + trailingData);
473 Q_ASSERT(s < INT_MAX);
474 return int(s);
475 }
476
477 static size_t align(size_t a) {
478 return (a + 7) & ~size_t(7);
479 }
480
481 const quint32_le *stringTable() const {
482 return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this + 1));
483 }
484
486 return stringTable()[i];
487 }
489 return stringTable()[size + i];
490 }
491};
492static_assert(sizeof(TemplateObject) == 4, "Template object structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
493
495{
501};
502static_assert(sizeof(ExportEntry) == 20, "ExportEntry structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
503
505{
510};
511static_assert(sizeof(ImportEntry) == 16, "ImportEntry structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
512
513// Qml data structures
514
516{
521};
522static_assert(sizeof(TranslationData) == 16, "TranslationData structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
523
525{
527
528 enum Type : unsigned int {
540 };
541
542 enum Flag : unsigned int {
553 IsPropertyObserver = 0x400
554 };
556
560
562 void setFlag(Flag flag) { flagsAndType.set<FlagsField>(flagsAndType.get<FlagsField>() | flag); }
563 bool hasFlag(Flag flag) const { return Flags(flagsAndType.get<FlagsField>()) & flag; }
564 Flags flags() const { return Flags(flagsAndType.get<FlagsField>()); }
565
567 Type type() const { return Type(flagsAndType.get<TypeField>()); }
568
569 union {
570 bool b;
572 quint32_le compiledScriptIndex; // used when Type_Script
574 quint32_le translationDataIndex; // used when Type_Translation
577 quint32_le stringIndex; // Set for Type_String and Type_Script (the latter because of script strings)
578
581
583 {
584 const Flags bindingFlags = flags();
585 return bindingFlags & IsSignalHandlerExpression
586 || bindingFlags & IsSignalHandlerObject
587 || bindingFlags & IsPropertyObserver;
588 }
589
590 bool isValueBinding() const
591 {
592 switch (type()) {
595 return false;
596 default:
598 }
599 }
600
603
604 bool isSignalHandler() const
605 {
610 return true;
611 }
612 return false;
613 }
614
616 {
617 if (type() == Type_AttachedProperty) {
621 return true;
622 }
623 return false;
624 }
625
626 bool isGroupProperty() const
627 {
628 if (type() == Type_GroupProperty) {
632 return true;
633 }
634 return false;
635 }
636
638
639 //reverse of Lexer::singleEscape()
640 static QString escapedString(const QString &string)
641 {
642 QString tmp = QLatin1String("\"");
643 for (int i = 0; i < string.size(); ++i) {
644 const QChar &c = string.at(i);
645 switch (c.unicode()) {
646 case 0x08:
647 tmp += QLatin1String("\\b");
648 break;
649 case 0x09:
650 tmp += QLatin1String("\\t");
651 break;
652 case 0x0A:
653 tmp += QLatin1String("\\n");
654 break;
655 case 0x0B:
656 tmp += QLatin1String("\\v");
657 break;
658 case 0x0C:
659 tmp += QLatin1String("\\f");
660 break;
661 case 0x0D:
662 tmp += QLatin1String("\\r");
663 break;
664 case 0x22:
665 tmp += QLatin1String("\\\"");
666 break;
667 case 0x27:
668 tmp += QLatin1String("\\\'");
669 break;
670 case 0x5C:
671 tmp += QLatin1String("\\\\");
672 break;
673 default:
674 tmp += c;
675 break;
676 }
677 }
678 tmp += QLatin1Char('\"');
679 return tmp;
680 }
681
683 {
684 const Binding::Type bindingType = type();
685 return bindingType == Type_Translation || bindingType == Type_TranslationById;
686 }
687 bool evaluatesToString() const { return type() == Type_String || isTranslationBinding(); }
688
689 bool valueAsBoolean() const
690 {
691 if (type() == Type_Boolean)
692 return value.b;
693 return false;
694 }
695};
696
697static_assert(sizeof(Binding) == 24, "Binding structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
698
700{
704};
705
706static_assert(sizeof(InlineComponent) == 12, "InlineComponent structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
707
709{
713};
714static_assert(sizeof(EnumValue) == 12, "EnumValue structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
715
716struct Enum
717{
721
722 const EnumValue *enumValueAt(int idx) const {
723 return reinterpret_cast<const EnumValue*>(this + 1) + idx;
724 }
725
726 static int calculateSize(int nEnumValues) {
727 return (sizeof(Enum)
728 + nEnumValues * sizeof(EnumValue)
729 + 7) & ~0x7;
730 }
731
732 // --- QQmlPropertyCacheCreatorInterface
733 const EnumValue *enumValuesBegin() const { return enumValueAt(0); }
734 const EnumValue *enumValuesEnd() const { return enumValueAt(nEnumValues); }
735 int enumValueCount() const { return nEnumValues; }
736 // ---
737};
738static_assert(sizeof(Enum) == 12, "Enum structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
739
740struct Signal
741{
745 // Parameter parameters[1];
746
747 const Parameter *parameterAt(int idx) const {
748 return reinterpret_cast<const Parameter*>(this + 1) + idx;
749 }
750
751 static int calculateSize(int nParameters) {
752 return (sizeof(Signal)
753 + nParameters * sizeof(Parameter)
754 + 7) & ~0x7;
755 }
756
757 // --- QQmlPropertyCacheCceatorInterface
758 const Parameter *parametersBegin() const { return parameterAt(0); }
759 const Parameter *parametersEnd() const { return parameterAt(nParameters); }
760 int parameterCount() const { return nParameters; }
761 // ---
762};
763static_assert(sizeof(Signal) == 12, "Signal structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
764
766{
767private:
773
774public:
783
785 {
786 data.set<CommonTypeOrTypeNameIndexField>(static_cast<quint32>(t));
787 data.set<IsCommonTypeField>(true);
788 }
789
791 if (data.get<IsCommonTypeField>() != 0)
793 return CommonType::Invalid;
794 }
795
797 {
799 data.set<IsCommonTypeField>(false);
800 }
801
802 int typeNameIndex() const
803 {
804 return data.get<IsCommonTypeField>() ? -1 : data.get<CommonTypeOrTypeNameIndexField>();
805 }
806
807 bool isCommonType() const { return data.get<IsCommonTypeField>(); }
809
810 bool isList() const { return data.get<IsListField>(); }
811 void setIsList(bool isList) { data.set<IsListField>(isList); }
812
813 bool isRequired() const { return data.get<IsRequiredField>(); }
815
816 bool isReadOnly() const { return data.get<IsReadOnlyField>(); }
818};
819static_assert(sizeof(Property) == 12, "Property structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
820
823};
824
825static_assert (sizeof(RequiredPropertyExtraData) == 4, "RequiredPropertyExtraData structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
826
827struct Alias {
828private:
831
832 // object id index (in QQmlContextData::idValues)
836
837public:
838
839 enum Flag : unsigned int {
841 Resolved = 0x2,
843 };
845
849
850 union {
853 quint32_le localAliasIndex; // index in list of aliases local to the object (if targetObjectId == objectId)
854 };
857
858 bool hasFlag(Flag flag) const
859 {
860 return nameIndexAndFlags.get<FlagsField>() & flag;
861 }
862
863 void setFlag(Flag flag)
864 {
866 }
867
869 {
871 }
872
874 {
875 return nameIndexAndFlags.get<NameIndexField>();
876 }
877
879 {
881 }
882
883 bool isObjectAlias() const
884 {
886 return encodedMetaPropertyIndex == -1;
887 }
888
890 {
892 }
893
895 {
897 }
898
899
901 {
903 }
904
906 {
908 }
909
911 {
913 }
914
916 {
918 }
919};
920static_assert(sizeof(Alias) == 20, "Alias structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
921
922struct Object
923{
924private:
928public:
929 enum Flag : unsigned int {
930 NoFlag = 0x0,
931 IsComponent = 0x1, // object was identified to be an explicit or implicit component boundary
932 HasDeferredBindings = 0x2, // any of the bindings are deferred
936 };
938
939 // Depending on the use, this may be the type name to instantiate before instantiating this
940 // object. For grouped properties the type name will be empty and for attached properties
941 // it will be the name of the attached type.
946 qint32_le indexOfDefaultPropertyOrAlias; // -1 means no default property declared in this object
954 quint32_le offsetToEnums; // which in turn will be a table with offsets to variable-sized Enum objects
955 quint32_le offsetToSignals; // which in turn will be a table with offsets to variable-sized Signal objects
967// Function[]
968// Property[]
969// Signal[]
970// Binding[]
971// InlineComponent[]
972// RequiredPropertyExtraData[]
973
974 Flags flags() const
975 {
977 }
978
979 bool hasFlag(Flag flag) const
980 {
982 }
983
984 void setFlag(Flag flag)
985 {
988 }
989
991 {
993 }
994
996 {
998 }
999
1000 void setHasAliasAsDefaultProperty(bool defaultAlias)
1001 {
1003 }
1004
1006 {
1008 }
1009
1011 {
1013 }
1014
1015
1017 {
1018 return ( sizeof(Object)
1019 + nFunctions * sizeof(quint32)
1020 + nProperties * sizeof(Property)
1021 + nAliases * sizeof(Alias)
1022 + nEnums * sizeof(quint32)
1023 + nSignals * sizeof(quint32)
1024 + nBindings * sizeof(Binding)
1025 + nNamedObjectsInComponent * sizeof(int)
1028 + 0x7
1029 ) & ~0x7;
1030 }
1031
1033 {
1034 return reinterpret_cast<const quint32_le*>(reinterpret_cast<const char *>(this) + offsetToFunctions);
1035 }
1036
1038 {
1039 return reinterpret_cast<const Property*>(reinterpret_cast<const char *>(this) + offsetToProperties);
1040 }
1041
1042 const Alias *aliasTable() const
1043 {
1044 return reinterpret_cast<const Alias*>(reinterpret_cast<const char *>(this) + offsetToAliases);
1045 }
1046
1047 const Binding *bindingTable() const
1048 {
1049 return reinterpret_cast<const Binding*>(reinterpret_cast<const char *>(this) + offsetToBindings);
1050 }
1051
1052 const Enum *enumAt(int idx) const
1053 {
1054 const quint32_le *offsetTable = reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToEnums);
1055 const quint32_le offset = offsetTable[idx];
1056 return reinterpret_cast<const Enum*>(reinterpret_cast<const char*>(this) + offset);
1057 }
1058
1059 const Signal *signalAt(int idx) const
1060 {
1061 const quint32_le *offsetTable = reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToSignals);
1062 const quint32_le offset = offsetTable[idx];
1063 return reinterpret_cast<const Signal*>(reinterpret_cast<const char*>(this) + offset);
1064 }
1065
1067 {
1068 return inlineComponentTable() + idx;
1069 }
1070
1072 {
1073 return reinterpret_cast<const quint32_le*>(reinterpret_cast<const char *>(this) + offsetToNamedObjectsInComponent);
1074 }
1075
1077 {
1078 return reinterpret_cast<const InlineComponent*>(reinterpret_cast<const char *>(this) + offsetToInlineComponents);
1079 }
1080
1082 {
1083 return requiredPropertyExtraDataTable() + idx;
1084 }
1085
1087 {
1088 return reinterpret_cast<const RequiredPropertyExtraData*>(reinterpret_cast<const char *>(this) + offsetToRequiredPropertyExtraData);
1089 }
1090
1091 // --- QQmlPropertyCacheCreator interface
1092 int propertyCount() const { return nProperties; }
1093 int aliasCount() const { return nAliases; }
1094 int enumCount() const { return nEnums; }
1095 int signalCount() const { return nSignals; }
1096 int functionCount() const { return nFunctions; }
1097
1098 const Binding *bindingsBegin() const { return bindingTable(); }
1099 const Binding *bindingsEnd() const { return bindingTable() + nBindings; }
1100 int bindingCount() const { return nBindings; }
1101
1102 const Property *propertiesBegin() const { return propertyTable(); }
1103 const Property *propertiesEnd() const { return propertyTable() + nProperties; }
1104
1105 const Alias *aliasesBegin() const { return aliasTable(); }
1106 const Alias *aliasesEnd() const { return aliasTable() + nAliases; }
1107
1109 EnumIterator enumsBegin() const { return EnumIterator(this, 0); }
1110 EnumIterator enumsEnd() const { return EnumIterator(this, nEnums); }
1111
1113 SignalIterator signalsBegin() const { return SignalIterator(this, 0); }
1115
1119
1123
1125 // ---
1126};
1127static_assert(sizeof(Object) == 84, "Object structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
1128
1130{
1131 enum ImportType : unsigned int {
1138
1141
1145
1147 {
1149 }
1150};
1151static_assert(sizeof(Import) == 20, "Import structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
1152
1154{
1159
1160 const Import *importAt(int idx) const {
1161 return reinterpret_cast<const Import*>((reinterpret_cast<const char *>(this)) + offsetToImports + idx * sizeof(Import));
1162 }
1163
1164 const Object *objectAt(int idx) const {
1165 const quint32_le *offsetTable = reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToObjects);
1166 const quint32_le offset = offsetTable[idx];
1167 return reinterpret_cast<const Object*>(reinterpret_cast<const char*>(this) + offset);
1168 }
1169};
1170static_assert(sizeof(QmlUnit) == 16, "QmlUnit structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
1171
1173static const char magic_str[] = "qv4cdata";
1174
1175struct Unit
1176{
1177 // DO NOT CHANGE THESE FIELDS EVER
1178 char magic[8];
1182 quint32_le unitSize; // Size of the Unit and any depending data.
1183 // END DO NOT CHANGE THESE FIELDS EVER
1184
1186
1187 char md5Checksum[16]; // checksum of all bytes following this field.
1189
1190 enum : unsigned int {
1192 StaticData = 0x2, // Unit data persistent in memory?
1194 IsSharedLibrary = 0x8, // .pragma shared?
1196 PendingTypeCompilation = 0x20, // the QML data structures present are incomplete and require type compilation
1197 IsStrict = 0x40,
1207 };
1242
1244
1245 /* QML specific fields */
1246
1247 const QmlUnit *qmlUnit() const {
1248 return reinterpret_cast<const QmlUnit *>(reinterpret_cast<const char *>(this) + offsetToQmlUnit);
1249 }
1250
1252 return reinterpret_cast<QmlUnit *>(reinterpret_cast<char *>(this) + offsetToQmlUnit);
1253 }
1254
1255 bool isSingleton() const {
1256 return flags & Unit::IsSingleton;
1257 }
1258 /* end QML specific fields*/
1259
1262 const quint32_le *offsetTable = reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToStringTable);
1263 const quint32_le offset = offsetTable[idx];
1264 const String *str = reinterpret_cast<const String*>(reinterpret_cast<const char *>(this) + offset);
1265 Q_ASSERT(str->size >= 0);
1266 if (str->size == 0)
1267 return QString();
1268#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
1269 const QChar *characters = reinterpret_cast<const QChar *>(str + 1);
1270 if (flags & StaticData)
1272 return QString(characters, str->size);
1273#else
1274 const quint16_le *characters = reinterpret_cast<const quint16_le *>(str + 1);
1276 QChar *ch = qstr.data();
1277 for (int i = 0; i < str->size; ++i)
1278 ch[i] = QChar(characters[i]);
1279 return qstr;
1280#endif
1281 }
1282
1283 const quint32_le *functionOffsetTable() const { return reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToFunctionTable); }
1284 const quint32_le *classOffsetTable() const { return reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToClassTable); }
1285 const quint32_le *templateObjectOffsetTable() const { return reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToTemplateObjectTable); }
1286 const quint32_le *blockOffsetTable() const { return reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToBlockTable); }
1287
1288 const Function *functionAt(int idx) const {
1289 const quint32_le *offsetTable = functionOffsetTable();
1290 const quint32_le offset = offsetTable[idx];
1291 return reinterpret_cast<const Function*>(reinterpret_cast<const char *>(this) + offset);
1292 }
1293
1294 const Class *classAt(int idx) const {
1295 const quint32_le *offsetTable = classOffsetTable();
1296 const quint32_le offset = offsetTable[idx];
1297 return reinterpret_cast<const Class *>(reinterpret_cast<const char *>(this) + offset);
1298 }
1299
1300 const TemplateObject *templateObjectAt(int idx) const {
1301 const quint32_le *offsetTable = templateObjectOffsetTable();
1302 const quint32_le offset = offsetTable[idx];
1303 return reinterpret_cast<const TemplateObject *>(reinterpret_cast<const char *>(this) + offset);
1304 }
1305
1306 const Block *blockAt(int idx) const {
1307 const quint32_le *offsetTable = blockOffsetTable();
1308 const quint32_le offset = offsetTable[idx];
1309 return reinterpret_cast<const Block *>(reinterpret_cast<const char *>(this) + offset);
1310 }
1311
1312 const Lookup *lookupTable() const { return reinterpret_cast<const Lookup*>(reinterpret_cast<const char *>(this) + offsetToLookupTable); }
1313 const RegExp *regexpAt(int index) const {
1314 return reinterpret_cast<const RegExp*>(reinterpret_cast<const char *>(this) + offsetToRegexpTable + index * sizeof(RegExp));
1315 }
1316 const quint64_le *constants() const {
1317 return reinterpret_cast<const quint64_le*>(reinterpret_cast<const char *>(this) + offsetToConstantTable);
1318 }
1319
1320 const JSClassMember *jsClassAt(int idx, int *nMembers) const {
1321 const quint32_le *offsetTable = reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + offsetToJSClassTable);
1322 const quint32_le offset = offsetTable[idx];
1323 const char *ptr = reinterpret_cast<const char *>(this) + offset;
1324 const JSClass *klass = reinterpret_cast<const JSClass *>(ptr);
1325 *nMembers = klass->nMembers;
1326 return reinterpret_cast<const JSClassMember*>(ptr + sizeof(JSClass));
1327 }
1328
1330 return reinterpret_cast<const TranslationData *>(reinterpret_cast<const char *>(this) + offsetToTranslationTable);
1331 }
1332
1333 const ImportEntry *importEntryTable() const { return reinterpret_cast<const ImportEntry *>(reinterpret_cast<const char *>(this) + offsetToImportEntryTable); }
1334 const ExportEntry *localExportEntryTable() const { return reinterpret_cast<const ExportEntry *>(reinterpret_cast<const char *>(this) + offsetToLocalExportEntryTable); }
1335 const ExportEntry *indirectExportEntryTable() const { return reinterpret_cast<const ExportEntry *>(reinterpret_cast<const char *>(this) + offsetToIndirectExportEntryTable); }
1336 const ExportEntry *starExportEntryTable() const { return reinterpret_cast<const ExportEntry *>(reinterpret_cast<const char *>(this) + offsetToStarExportEntryTable); }
1337
1338 const quint32_le *moduleRequestTable() const { return reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + offsetToModuleRequestTable); }
1339};
1340
1341static_assert(sizeof(Unit) == 248, "Unit structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
1342
1344{
1346 : location(loc)
1349 {}
1350 Location location; // first use
1351 bool needsCreation : 1; // whether the type needs to be creatable or not
1353};
1354
1355// Map from name index to location of first use.
1356struct TypeReferenceMap : QHash<int, TypeReference>
1357{
1358 TypeReference &add(int nameIndex, const Location &loc) {
1359 Iterator it = find(nameIndex);
1360 if (it != end())
1361 return *it;
1362 return *insert(nameIndex, loc);
1363 }
1364
1365 template <typename CompiledObject>
1366 void collectFromObject(const CompiledObject *obj)
1367 {
1368 if (obj->inheritedTypeNameIndex != 0) {
1369 TypeReference &r = this->add(obj->inheritedTypeNameIndex, obj->location);
1370 r.needsCreation = true;
1371 r.errorWhenNotFound = true;
1372 }
1373
1374 auto prop = obj->propertiesBegin();
1375 auto const propEnd = obj->propertiesEnd();
1376 for ( ; prop != propEnd; ++prop) {
1377 if (!prop->isCommonType()) {
1378 TypeReference &r = this->add(prop->commonTypeOrTypeNameIndex(), prop->location);
1379 r.errorWhenNotFound = true;
1380 }
1381 }
1382
1383 auto binding = obj->bindingsBegin();
1384 auto const bindingEnd = obj->bindingsEnd();
1385 for ( ; binding != bindingEnd; ++binding) {
1387 this->add(binding->propertyNameIndex, binding->location);
1388 }
1389
1390 auto ic = obj->inlineComponentsBegin();
1391 auto const icEnd = obj->inlineComponentsEnd();
1392 for (; ic != icEnd; ++ic) {
1393 this->add(ic->nameIndex, ic->location);
1394 }
1395 }
1396
1397 template <typename Iterator>
1399 {
1400 for (; it != end; ++it)
1402 }
1403};
1404
1405using DependentTypesHasher = std::function<QByteArray()>;
1406
1407// This is how this hooks into the existing structures:
1408
1410{
1411 Q_DISABLE_COPY(CompilationUnitBase)
1412
1415
1416 CompilationUnitBase(CompilationUnitBase &&other) noexcept { *this = std::move(other); }
1417
1419 {
1420 if (this != &other) {
1421 runtimeStrings = other.runtimeStrings;
1422 other.runtimeStrings = nullptr;
1423 constants = other.constants;
1424 other.constants = nullptr;
1425 runtimeRegularExpressions = other.runtimeRegularExpressions;
1426 other.runtimeRegularExpressions = nullptr;
1427 runtimeClasses = other.runtimeClasses;
1428 other.runtimeClasses = nullptr;
1429 imports = other.imports;
1430 other.imports = nullptr;
1431 }
1432 return *this;
1433 }
1434
1435 // pointers either to data->constants() or little-endian memory copy.
1436 Heap::String **runtimeStrings = nullptr; // Array
1437 const StaticValue* constants = nullptr;
1440 const StaticValue** imports = nullptr;
1441};
1442
1443Q_STATIC_ASSERT(std::is_standard_layout<CompilationUnitBase>::value);
1444Q_STATIC_ASSERT(offsetof(CompilationUnitBase, runtimeStrings) == 0);
1445Q_STATIC_ASSERT(offsetof(CompilationUnitBase, constants) == sizeof(QV4::Heap::String **));
1446Q_STATIC_ASSERT(offsetof(CompilationUnitBase, runtimeRegularExpressions) == offsetof(CompilationUnitBase, constants) + sizeof(const StaticValue *));
1447Q_STATIC_ASSERT(offsetof(CompilationUnitBase, runtimeClasses) == offsetof(CompilationUnitBase, runtimeRegularExpressions) + sizeof(const StaticValue *));
1448Q_STATIC_ASSERT(offsetof(CompilationUnitBase, imports) == offsetof(CompilationUnitBase, runtimeClasses) + sizeof(const StaticValue *));
1449
1451{
1452 Q_DISABLE_COPY(CompilationUnit)
1453
1454 const Unit *data = nullptr;
1455 const QmlUnit *qmlData = nullptr;
1457 const QQmlPrivate::AOTCompiledFunction *aotCompiledFunctions = nullptr;
1458public:
1459 using CompiledObject = CompiledData::Object;
1460
1461 CompilationUnit(const Unit *unitData = nullptr, const QString &fileName = QString(),
1462 const QString &finalUrlString = QString())
1463 {
1465 }
1466
1468 const QString &fileName = QString(), const QString &finalUrlString = QString())
1470 {
1471 this->aotCompiledFunctions = aotCompiledFunctions;
1472 }
1473
1475 {
1476 if (data) {
1477 if (data->qmlUnit() != qmlData)
1478 free(const_cast<QmlUnit *>(qmlData));
1479 qmlData = nullptr;
1480
1482 free(const_cast<Unit *>(data));
1483 }
1484 data = nullptr;
1485#if Q_BYTE_ORDER == Q_BIG_ENDIAN
1486 delete [] constants;
1487 constants = nullptr;
1488#endif
1489
1490 delete [] imports;
1491 imports = nullptr;
1492 }
1493
1495 {
1496 *this = std::move(other);
1497 }
1498
1500 {
1501 if (this != &other) {
1502 data = other.data;
1503 other.data = nullptr;
1504 qmlData = other.qmlData;
1505 other.qmlData = nullptr;
1506 dynamicStrings = std::move(other.dynamicStrings);
1507 aotCompiledFunctions = other.aotCompiledFunctions;
1508 other.dynamicStrings.clear();
1509 m_fileName = std::move(other.m_fileName);
1510 other.m_fileName.clear();
1511 m_finalUrlString = std::move(other.m_finalUrlString);
1512 other.m_finalUrlString.clear();
1513 m_module = other.m_module;
1514 other.m_module = nullptr;
1516 }
1517 return *this;
1518 }
1519
1520 const Unit *unitData() const { return data; }
1521
1522 void setUnitData(const Unit *unitData, const QmlUnit *qmlUnit = nullptr,
1523 const QString &fileName = QString(), const QString &finalUrlString = QString())
1524 {
1525 data = unitData;
1526 qmlData = nullptr;
1527#if Q_BYTE_ORDER == Q_BIG_ENDIAN
1528 delete [] constants;
1529#endif
1530 constants = nullptr;
1531 m_fileName.clear();
1532 m_finalUrlString.clear();
1533 if (!data)
1534 return;
1535
1536 qmlData = qmlUnit ? qmlUnit : data->qmlUnit();
1537
1538#if Q_BYTE_ORDER == Q_BIG_ENDIAN
1539 StaticValue *bigEndianConstants = new StaticValue[data->constantTableSize];
1540 const quint64_le *littleEndianConstants = data->constants();
1541 for (uint i = 0; i < data->constantTableSize; ++i)
1542 bigEndianConstants[i] = StaticValue::fromReturnedValue(littleEndianConstants[i]);
1543 constants = bigEndianConstants;
1544#else
1545 constants = reinterpret_cast<const StaticValue*>(data->constants());
1546#endif
1547
1548 m_fileName = !fileName.isEmpty() ? fileName : stringAt(data->sourceFileIndex);
1549 m_finalUrlString = !finalUrlString.isEmpty() ? finalUrlString : stringAt(data->finalUrlIndex);
1550 }
1551
1553 {
1554 if (index < data->stringTableSize)
1555 return data->stringAtInternal(index);
1556
1557 const qsizetype dynamicIndex = index - data->stringTableSize;
1558 Q_ASSERT(dynamicIndex < dynamicStrings.size());
1559 return dynamicStrings.at(dynamicIndex);
1560 }
1561
1562 QString fileName() const { return m_fileName; }
1563 QString finalUrlString() const { return m_finalUrlString; }
1564
1565 Heap::Module *module() const { return m_module; }
1566 void setModule(Heap::Module *module) { m_module = module; }
1567
1569 {
1570 using namespace CompiledData;
1571 switch (binding->type()) {
1574 return stringAt(binding->stringIndex);
1575 case Binding::Type_Null:
1576 return QStringLiteral("null");
1578 return binding->value.b ? QStringLiteral("true") : QStringLiteral("false");
1582 return QString();
1585 return stringAt(data->translations()[binding->value.translationDataIndex].stringIndex);
1586 default:
1587 break;
1588 }
1589 return QString();
1590 }
1591
1593 {
1594 return (binding->type() == CompiledData::Binding::Type_String)
1596 : bindingValueAsString(binding);
1597 }
1598
1599 double bindingValueAsNumber(const CompiledData::Binding *binding) const
1600 {
1601 if (binding->type() != CompiledData::Binding::Type_Number)
1602 return 0.0;
1603 return constants[binding->value.constantValueIndex].doubleValue();
1604 }
1605
1606private:
1607 QString m_fileName; // initialized from data->sourceFileIndex
1608 QString m_finalUrlString; // initialized from data->finalUrlIndex
1609
1610 Heap::Module *m_module = nullptr;
1611};
1612
1614{
1615 Q_DISABLE_COPY_MOVE(SaveableUnitPointer)
1616public:
1617 SaveableUnitPointer(const Unit *unit, quint32 temporaryFlags = Unit::StaticData) :
1618 unit(unit),
1619 temporaryFlags(temporaryFlags)
1620 {
1621 }
1622
1624
1625 template<typename Char>
1626 bool saveToDisk(const std::function<bool(const Char *, quint32)> &writer) const
1627 {
1628 const quint32_le oldFlags = mutableFlags();
1629 auto cleanup = qScopeGuard([this, oldFlags]() { mutableFlags() = oldFlags; });
1630 mutableFlags() |= temporaryFlags;
1631 return writer(data<Char>(), size());
1632 }
1633
1634 static bool writeDataToFile(const QString &outputFileName, const char *data, quint32 size,
1635 QString *errorString)
1636 {
1637#if QT_CONFIG(temporaryfile)
1638 QSaveFile cacheFile(outputFileName);
1640 || cacheFile.write(data, size) != size
1641 || !cacheFile.commit()) {
1642 *errorString = cacheFile.errorString();
1643 return false;
1644 }
1645
1646 errorString->clear();
1647 return true;
1648#else
1649 Q_UNUSED(outputFileName);
1650 *errorString = QStringLiteral("features.temporaryfile is disabled.");
1651 return false;
1652#endif
1653 }
1654
1655private:
1656 const Unit *unit;
1657 quint32 temporaryFlags;
1658
1659 quint32_le &mutableFlags() const
1660 {
1661 return const_cast<Unit *>(unit)->flags;
1662 }
1663
1664 template<typename Char>
1665 const Char *data() const
1666 {
1667 Q_STATIC_ASSERT(sizeof(Char) == 1);
1668 const Char *dataPtr;
1669 memcpy(&dataPtr, &unit, sizeof(dataPtr));
1670 return dataPtr;
1671 }
1672
1673 quint32 size() const
1674 {
1675 return unit->unitSize;
1676 }
1677};
1678
1679
1680} // CompiledData namespace
1681} // QV4 namespace
1682
1683Q_DECLARE_OPERATORS_FOR_FLAGS(QV4::CompiledData::ParameterType::Flags);
1685
1687
1688#endif
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qchar.h:48
\inmodule QtCore
Definition qhash.h:818
iterator find(const int &key)
Returns an iterator pointing to the item with the key in the hash.
Definition qhash.h:1258
iterator Iterator
Qt-style synonym for QHash::iterator.
Definition qhash.h:1255
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
Definition qhash.h:1206
iterator insert(const int &key, const TypeReference &value)
Inserts a new item with the key and a value of value.
Definition qhash.h:1283
\inmodule QtCore \reentrant
Definition qiodevice.h:34
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
QString errorString() const
Returns a human-readable description of the last device error that occurred.
@ FloatingPointShortest
Definition qlocale.h:880
The QQmlEngine class provides an environment for instantiating QML components.
Definition qqmlengine.h:57
\inmodule QtCore
Definition qsavefile.h:24
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
bool commit()
Commits the changes to disk, if all previous writes were successful.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
void clear()
Clears the contents of the string and makes it null.
Definition qstring.h:1107
qsizetype size() const
Returns the number of characters in this string.
Definition qstring.h:182
static QString fromRawData(const QChar *, qsizetype size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
Definition qstring.cpp:9242
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
QChar * data()
Returns a pointer to the data stored in the QString.
Definition qstring.h:1095
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:7822
\inmodule QtCore
static constexpr QTypeRevision zero()
Produces a QTypeRevision with major and minor version {0}.
static bool writeDataToFile(const QString &outputFileName, const char *data, quint32 size, QString *errorString)
bool saveToDisk(const std::function< bool(const Char *, quint32)> &writer) const
SaveableUnitPointer(const Unit *unit, quint32 temporaryFlags=Unit::StaticData)
QString str
[2]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
std::function< QByteArray()> DependentTypesHasher
static const char magic_str[]
\qmltype Particle \inqmlmodule QtQuick.Particles
uint Bool
constexpr Initialization Uninitialized
#define Q_STATIC_ASSERT(Condition)
Definition qassert.h:105
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
QLEInteger< quint32 > quint32_le
Definition qendian.h:396
constexpr QSpecialIntegerBitfieldInitializer QSpecialIntegerBitfieldZero
Definition qendian_p.h:24
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
Flags
void(^ Block)(void)
static ControlElement< T > * ptr(QWidget *widget)
@ Alias
GLint location
GLboolean GLboolean GLboolean b
GLenum mode
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLboolean r
[2]
GLuint GLuint end
GLenum GLuint id
[7]
GLenum type
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLenum GLenum GLsizei void GLsizei void * column
GLhandleARB obj
[2]
const GLubyte * c
GLdouble GLdouble t
Definition qopenglext.h:243
GLdouble s
[6]
Definition qopenglext.h:235
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
Definition qscopeguard.h:60
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define QStringLiteral(str)
char Char
#define Q_UNUSED(x)
@ Q_PRIMITIVE_TYPE
Definition qtypeinfo.h:144
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:163
unsigned int quint32
Definition qtypes.h:45
unsigned short quint16
Definition qtypes.h:43
int qint32
Definition qtypes.h:44
ptrdiff_t qsizetype
Definition qtypes.h:70
unsigned int uint
Definition qtypes.h:29
unsigned char quint8
Definition qtypes.h:41
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
QList< QChar > characters
QSharedPointer< T > other(t)
[5]
\inmodule QtCore \reentrant
Definition qchar.h:17
void setIsAliasToLocalAlias(bool isAliasToLocalAlias)
void setTargetObjectId(quint32 targetObjectId)
quint32_le_bitfield_union< NameIndexField, FlagsField > nameIndexAndFlags
bool hasFlag(Flag flag) const
quint32_le_bitfield_union< IdIndexField, TargetObjectIdField, AliasToLocalAliasField > idIndexAndTargetObjectIdAndAliasToLocalAlias
void setNameIndex(quint32 nameIndex)
void setIdIndex(quint32 idIndex)
quint32_le_bitfield_union< FlagsField, TypeField > flagsAndType
union QV4::CompiledData::Binding::@543 value
bool hasFlag(Flag flag) const
static QString escapedString(const QString &string)
const quint32_le * localsTable() const
static size_t align(size_t a)
static int calculateSize(int nLocals)
static int calculateSize(int nStaticMethods, int nMethods)
static size_t align(size_t a)
const Method * methodTable() const
CompilationUnitBase & operator=(CompilationUnitBase &&other) noexcept
QString bindingValueAsScriptString(const CompiledData::Binding *binding) const
void setUnitData(const Unit *unitData, const QmlUnit *qmlUnit=nullptr, const QString &fileName=QString(), const QString &finalUrlString=QString())
double bindingValueAsNumber(const CompiledData::Binding *binding) const
CompilationUnit(CompilationUnit &&other) noexcept
const QQmlPrivate::AOTCompiledFunction * aotCompiledFunctions
CompilationUnit(const Unit *unitData, const QQmlPrivate::AOTCompiledFunction *aotCompiledFunctions, const QString &fileName=QString(), const QString &finalUrlString=QString())
CompilationUnit & operator=(CompilationUnit &&other) noexcept
void setModule(Heap::Module *module)
QString bindingValueAsString(const CompiledData::Binding *binding) const
const EnumValue * enumValueAt(int idx) const
const EnumValue * enumValuesEnd() const
const EnumValue * enumValuesBegin() const
static int calculateSize(int nEnumValues)
const quint32_le * localsTable() const
static size_t align(size_t a)
const CodeOffsetToLineAndStatement * lineAndStatementNumberTable() const
static int calculateSize(int nFormals, int nLocals, int nLinesAndStatements, int nInnerfunctions, int labelInfoSize, int codeSize)
size_t lineAndStatementNumberOffset() const
const Parameter * formalsTable() const
const Parameter * formalsEnd() const
const Parameter * formalsBegin() const
const quint32_le * labelInfoTable() const
void set(quint32 nameOffset, bool isAccessor)
static int calculateSize(int nMembers)
Location(quint32 l, quint32 c)
void set(quint32 line, quint32 column)
friend size_t qHash(const Location &location, size_t seed=0)
bool operator<(const Location &other) const
friend bool operator==(const Location &a, const Location &b)
Lookup(Type type, Mode mode, quint32 nameIndex)
TableIterator< Enum, Object, &Object::enumAt > EnumIterator
EnumIterator enumsBegin() const
Q_DECLARE_FLAGS(Flags, Flag)
const RequiredPropertyExtraData * requiredPropertyExtraDataAt(int idx) const
EnumIterator enumsEnd() const
const Enum * enumAt(int idx) const
RequiredPropertyExtraDataIterator requiredPropertyExtraDataEnd() const
const RequiredPropertyExtraData * requiredPropertyExtraDataTable() const
TableIterator< Signal, Object, &Object::signalAt > SignalIterator
const Binding * bindingsEnd() const
bool hasFlag(Flag flag) const
const Property * propertyTable() const
SignalIterator signalsBegin() const
quint32_le_bitfield_union< FlagsField, DefaultPropertyIsAliasField, IdField > flagsAndDefaultPropertyIsAliasAndId
InlineComponentIterator inlineComponentsEnd() const
const Alias * aliasTable() const
const InlineComponent * inlineComponentAt(int idx) const
const Property * propertiesEnd() const
const Binding * bindingTable() const
const Signal * signalAt(int idx) const
const Property * propertiesBegin() const
const quint32_le * functionOffsetTable() const
static int calculateSizeExcludingSignalsAndEnums(int nFunctions, int nProperties, int nAliases, int nEnums, int nSignals, int nBindings, int nNamedObjectsInComponent, int nInlineComponents, int nRequiredPropertyExtraData)
TableIterator< InlineComponent, Object, &Object::inlineComponentAt > InlineComponentIterator
const InlineComponent * inlineComponentTable() const
InlineComponentIterator inlineComponentsBegin() const
TableIterator< RequiredPropertyExtraData, Object, &Object::requiredPropertyExtraDataAt > RequiredPropertyExtraDataIterator
SignalIterator signalsEnd() const
const Alias * aliasesEnd() const
const Binding * bindingsBegin() const
RequiredPropertyExtraDataIterator requiredPropertyExtraDataBegin() const
void setHasAliasAsDefaultProperty(bool defaultAlias)
const Alias * aliasesBegin() const
const quint32_le * namedObjectsInComponentTable() const
void set(Flags flags, quint32 typeNameIndexOrCommonType)
void setIsReadOnly(bool isReadOnly)
void setTypeNameIndex(int nameIndex)
quint32_le_bitfield_union< CommonTypeOrTypeNameIndexField, IsRequiredField, IsCommonTypeField, IsListField, IsReadOnlyField > data
void setIsRequired(bool isRequired)
const Object * objectAt(int idx) const
const Import * importAt(int idx) const
RegExp(quint32 flags, quint32 stringIndex)
const Parameter * parametersBegin() const
static int calculateSize(int nParameters)
const Parameter * parametersEnd() const
const Parameter * parameterAt(int idx) const
static int calculateSize(const QString &str)
bool operator==(const TableIterator &rhs) const
bool operator!=(const TableIterator &rhs) const
TableIterator(const Container *container, int index)
const quint32_le * stringTable() const
void collectFromObject(const CompiledObject *obj)
TypeReference & add(int nameIndex, const Location &loc)
void collectFromObjects(Iterator it, Iterator end)
quint32_le offsetToIndirectExportEntryTable
const TranslationData * translations() const
const ExportEntry * indirectExportEntryTable() const
const quint64_le * constants() const
QString stringAtInternal(uint idx) const
const quint32_le * functionOffsetTable() const
const Function * functionAt(int idx) const
const TemplateObject * templateObjectAt(int idx) const
const ExportEntry * starExportEntryTable() const
const Lookup * lookupTable() const
const RegExp * regexpAt(int index) const
const Block * blockAt(int idx) const
const ExportEntry * localExportEntryTable() const
const quint32_le * classOffsetTable() const
const quint32_le * moduleRequestTable() const
char libraryVersionHash[QmlCompileHashSpace]
const Class * classAt(int idx) const
const ImportEntry * importEntryTable() const
const QmlUnit * qmlUnit() const
const quint32_le * blockOffsetTable() const
const JSClassMember * jsClassAt(int idx, int *nMembers) const
const quint32_le * templateObjectOffsetTable() const
QV4_NEARLY_ALWAYS_INLINE double doubleValue() const
static constexpr StaticValue fromReturnedValue(ReturnedValue val)
Definition moc.h:24