| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
This is the only other place in the moc sources where this function is
called, so avoid two calls into the QMetaType built-in type search.
Change-Id: Ia4a554c3bc5393fdc07bfffdc6071f5b9759afe8
Reviewed-by: Ahmad Samir <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just use QMetaType::fromName(). We bypass the id() call because anything
that came from the registry is, by definition, registered. Besides,
inside a bootstrapped tool, there are no custom types anyway.
Drive-by static'ify the functions.
Pick-to: 6.10
Change-Id: Ib8363744834da6d79046fffd0adb680219c829e0
Reviewed-by: Ahmad Samir <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
We must not add an enum qualifie if it is already emitted because
it was part of the property signature.
Amends dea21545b32cf04337ca470483991dc7da39ba5b
Fixes: QTBUG-137850
Pick-to: 6.10 6.9
Change-Id: I07a27014023a60f07a97e323a7d7e5b9d233d555
Reviewed-by: Joerg Bornemann <[email protected]>
|
|
|
|
|
|
|
|
| |
It's always been unnecessary in this position.
Pick-to: 6.10
Change-Id: Ia6a411f0cdaacd625a2cfffd2a94adbde2fbff6b
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is possible (and somewhat common on Windows) to have getters and
types with the same name. This so far would cause issues in the moc
generated code.
To fix it, we remember all names of enums found in a class, and prefix
references to such types with "enum". Note that this requires a new set
to track them, as other parts of moc currently treat `eunm Foo { Val }`
and `typedef enum { Val } Foo` the same, but `enum Foo` is only valid
C++ for the former.
A similar issue would also exist with inner structs, but that seems to
be less common, so isn't implemented yet.
We also use the opportunity to drop the typeNameForCast member in
ArgumentDef, as we can't do the enum disambiguation with it easily.
Instead, we do it on-demand, which should also give a beneficial
memory/runtime trade-off in any case.
Fixes: QTBUG-137452
Pick-to: 6.10 6.9
Change-Id: I07341f971c9ca65edecbea890ebc33e007087c43
Reviewed-by: Joerg Bornemann <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
| |
Make it match the one for the other property-related operations.
Change-Id: I9248cca81f9ab48cf6765f66d696631e91f5ad07
Reviewed-by: Thiago Macieira <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
| |
To avoid changing the ref count and the associated atomic operations.
Change-Id: I4195383bc15b36be564909bbdbc0abebc3b00787
Reviewed-by: Mårten Nordheim <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When creating the list of 'enums' to print into the moc file we
go through enums that have been defined and then we consult
aliases pointing to those names. If an alias is known we also
add this to the list. But we don't copy over the flags for the alias so
they have the exact same flags as the original enum.
In practice this is not a problem, the only flag it carries is
'EnumIsFlag' and we independently deduce this using the fact that it's
an alias.
It only really reveals itself in moc-output since we cannot
differentiate it from enum, so we print them all prefixed with an 'enum'
comment.
Change-Id: Iad055e69549ec1e854e1b5ac9992b035a4c343b4
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
| |
[ChangeLog][Third-Party Code] The copy of TinyCBOR in Qt was updated to
0.6.1.
Pick-to: 6.9 6.9.0 6.8 6.8.3 6.5 5.15
Change-Id: If5d5ef6220874ae8858efffd1712a567597b6317
Reviewed-by: Marc Mutz <[email protected]>
|
|
|
|
|
|
|
|
|
| |
We can detect whether the intent is to require completeness by having
Unique = void. This simplifies QtMocHelpers as well, removing one more
class that needed to be instantiated for each metatype.
Change-Id: I3a256568bb6ce1754399fffd6f61144d0a3e8deb
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes the last file-scope static variable by moving the
stringdata into a merged MetaObjectContents resulting structure. We now
only have two class-scope private static inline member template
variables. It also removes the wish to merge the strings' integer data
into the regular uint array, since effectively they are now merged.
Eventually, this should lead to moving the strings into the XxxxData
classes so moc doesn't have to collect them early. I don't have a
solution for this yet but have some ideas.
I've left the StringData class behind because I've found it useful for
QMetaObjectBuilder::toCode().
Generated code for QDeviceClosedNotifier (qtextstream.cpp), c++filt'ered:
.section .rodata,"a",@progbits
QDeviceClosedNotifier::qt_staticMetaObjectStaticContent<(anonymous namespace)::qt_meta_tag_ZN21QDeviceClosedNotifierE_t>:
.long 13 # 0xd
.long 0 # 0x0
.long 0 # 0x0
.long 0 # 0x0
.long 1 # 0x1
.long 14 # 0xe
.long 0 # 0x0
.long 0 # 0x0
.long 0 # 0x0
.long 0 # 0x0
.long 0 # 0x0
.long 0 # 0x0
.long 0 # 0x0
.long 0 # 0x0
.long 1 # 0x1
.long 0 # 0x0
.long 20 # 0x14
.long 2 # 0x2
.long 10 # 0xa
.long 1 # 0x1
.long 43 # 0x2b
.long 0 # 0x0
.long 24 # 0x18
.long 21 # 0x15
.long 46 # 0x2e
.long 11 # 0xb
.long 58 # 0x3a
.long 0 # 0x0
.asciz "QDeviceClosedNotifier\000flushStream\000"
.zero 1
.section .data.rel.ro,"aw",@progbits
QDeviceClosedNotifier::qt_staticMetaObjectRelocatingContent<(anonymous namespace)::qt_meta_tag_ZN21QDeviceClosedNotifierE_t>:
.quad QtPrivate::QMetaTypeInterfaceWrapper<void>::metaType
.quad QtPrivate::QMetaTypeInterfaceWrapper<void>::metaType
.globl QDeviceClosedNotifier::staticMetaObject
QDeviceClosedNotifier::staticMetaObject:
.quad QObject::staticMetaObject
.quad QDeviceClosedNotifier::qt_staticMetaObjectStaticContent<(anonymous namespace)::qt_meta_tag_ZN21QDeviceClosedNotifierE_t>+88
.quad QDeviceClosedNotifier::qt_staticMetaObjectStaticContent<(anonymous namespace)::qt_meta_tag_ZN21QDeviceClosedNotifierE_t>
.quad QDeviceClosedNotifier::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)
.quad 0
.quad QDeviceClosedNotifier::qt_staticMetaObjectRelocatingContent<(anonymous namespace)::qt_meta_tag_ZN21QDeviceClosedNotifierE_t>
.quad 0
Change-Id: I484c9165989ae4eaeea1fffd196c08947c083cb5
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ActiveQt dumpcpp could use this so
Q_PROPERTY(class Accounts *Accounts READ Accounts)
can compile. moc will now generate:
QtMocHelpers::UintData qt_properties {
// property 'Accounts'
QtMocHelpers::PropertyData<class Accounts*>(1, 0x80000000 | 2, QMC::DefaultPropertyFlags | QMC::EnumOrFlag),
};
if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< class Accounts* >(); break;
}
}
if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast<class Accounts**>(_v) = _t->Accounts(); break;
default: break;
}
}
Change-Id: Ibb85c3a067054d017b05fffdbd500f302f655bd9
Reviewed-by: Ahmad Samir <[email protected]>
Reviewed-by: Oliver Wolff <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is one minor difference: we now use operator== instead of
operator!= now, so some defective types may start working (but may break
some other, defective types).
Simplifies the emitted code, from
case 6:
if (_t->sMember != *reinterpret_cast< QString*>(_v)) {
_t->sMember = *reinterpret_cast< QString*>(_v);
Q_EMIT _t->member5Changed(_t->sMember);
}
break;
case 8:
if (_t->sub.m_string != *reinterpret_cast< QString*>(_v)) {
_t->sub.m_string = *reinterpret_cast< QString*>(_v);
}
break;
to:
case 6:
if (QtMocHelpers::setProperty(_t->sMember, *reinterpret_cast<QString*>(_v)))
Q_EMIT _t->member5Changed(_t->sMember);
break;
case 8: QtMocHelpers::setProperty(_t->sub.m_string, *reinterpret_cast<QString*>(_v)); break;
The second parameter to setProperty() helper is passed as an rvalue
reference and forwarded to the assignment, making this ready for move
semantics when moc generates code for it.
Change-Id: I45ad4a236d38f6c8f994fffd701d4193504d985a
Reviewed-by: Ahmad Samir <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
| |
So it doesn't have to clean up the output, which it may get wrong. It
doesn't want the qt_static_metacall function or the signal
implementations.
Change-Id: Ia0b110db8d5ef60020bdfffdbe547052dcff210e
Reviewed-by: Oliver Wolff <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This moves the ugliness of the reinterpret and const casts to the helper
function.
From:
void QObject::objectNameChanged(const QString & _t1, QPrivateSignal _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(std::addressof(_t1))), const_cast<void*>(reinterpret_cast<const void*>(std::addressof(_t2))) };
QMetaObject::activate(this, &staticMetaObject, 2, _a);
}
To:
void QObject::objectNameChanged(const QString & _t1, QPrivateSignal _t2)
{
QMetaObject::activate<void>(this, &staticMetaObject, 2, nullptr, _t1, _t2);
}
The overloads are disambiguated by the use of explicit template
parameter syntax. Note that zero-parameter void-returning signals remain
as they were.
Change-Id: I7b9d1870a8c80a49d207fffd00f79c6d9672cb54
Reviewed-by: Ahmad Samir <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From:
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QObject::*)(QObject * );
if (_t _q_method = &QObject::destroyed; *reinterpret_cast<_t *>(_a[1]) == _q_method) {
*result = 0;
return;
}
}
to:
if (QtMocHelpers::indexOfMethod<void (QObject::*)(QObject * )>(_a, &QObject::destroyed, 0))
return;
At the expense of a template instantiation.
Change-Id: Ieea308aedae6de4f0d94fffdcab6180485bd924f
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Amends commit da4a6cf78ff42a4f69c2775997ff174ef647f3f3 ("moc: generate
the uint data using the new constexpr functions"), which introduced the
constexpr way of generating the meta object contents. It did fix some of
the problems the old method from Qt 4.0 had but introduced another: the
qt_call_create_metaobject() template function wasn't necessarily friends
with the scope where the QObject-derived class was defined, as in:
class Outer
{
class Inner;
};
class Outer::Inner : public QObject
{
Q_OBJECT
};
This commit replaces said function as well as two of the static
variables in the global namespace that moc generated (qt_meta_xxx) with
static member template variables (for Q_OBJECT and Q_GADGET). Because
they are members, they automatically have access to the
qt_create_metaobject() member template function. Like it, they are
templated on the locally-defined tag type, to prevent unnecessary
exporting.
For Q_NAMESPACE, the current solution works, because no access
protection can apply. Trying to use template variables is more trouble
than it's worth and causes warnings-turned-errors in headersclean, for
example. This commit renames them, though, so the generator.cpp code is
common.
Fixes: QTBUG-129570
Change-Id: If8918852001be347fba9fffd5407faffb2bb45c1
Reviewed-by: Ivan Solovev <[email protected]>
|
|
|
|
|
|
|
|
| |
This removes the venerable integer generation at moc time that was added
in Qt 4.0, in favor of the generation at constexpr time.
Change-Id: Ia1238b1de442a329d739fffd91d1498cad70bfb9
Reviewed-by: Ivan Solovev <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's a meta method so it must have a name and a return type, even though
constructors have neither. The method name of a constructor QMetaMethod
is the name of the class and the name is already required to be stored
at index 0. We just have to be careful when the class is not directly in
the global namespace, because then the first string contains the full
scope.
Prior to this change, it stored an empty string as the method return
type, but QMetaMethod::returnMetaType() already protects against reading
it, with:
if (!mobj || methodType() == QMetaMethod::Constructor)
return QMetaType{};
which was added in commit fa987d44417528856d5e80ed7b48ba99e19fa307
("MetaObject: Store the QMetaType of the methods") because there is no
metatype stored for this non-existent return type. This commit repeats
some of that to QMetaMethod::typeName().
Change-Id: Ia903287c2c07b1d588a9fffdaf22fff0b0d6ce9f
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
| |
We now need to pass the meta type of the gadget (if it is one) and the
unique type for disambiguation into our generator.
Change-Id: I8a96935cf6c742259c9dfffd17ea937d8beed1ec
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This code appears to be legacy from Qt 3's way of handling properties of
enum types, because back then there was no QFlags and QVariant had a
limited set of types it could use. To support flags and enum types,
QObject::property() and setProperty() were coded to pass ints if the
property had the isEnumType() flag set. This code was ported to the new
(static) QMetaObject format in Qt 4 before QVariant gained support for
user types. When QVariant gained support for user types, support for
enums was changed to use the actual enum type in the property accessors,
which compiles for non-scoped enums (C++11).
This commit causes such code to produce a warning, to warn users that
they need to update their API. I have found no use of this in Qt or Qt
Creator code, but users may have something ported from Qt 3 that simply
still worked. We do have one setter taking int in QtWidgets
(QGroupBox::setAlignment), which isn't getting deprecated by this change
because QFlags can still be constructed (without warning) from integers,
through QFlag.
GCC warning:
qtmochelpers.h: In instantiation of ‘std::enable_if_t<...> QtMocHelpers::assignFlags(void*, I) [with ...]’:
moc_flags-property-integer-access.cpp:92:49: required from here
uint from a Q_PROPERTY that is a Q_FLAG is deprecated; please update to return the actual property's type [-Wdeprecated-declarations]
qtmochelpers.h:104:13: note: declared here
Clang warning:
qtmochelpers.h:113:5: warning: 'assignFlagsFromInteger<ClassWithFlagsAccessAsInteger::Flag>' is deprecated: Returning int/uint from a Q_PROPERTY that is a Q_FLAG is deprecated; please update to return the actual property's type [-Wdeprecated-declarations]
moc_flags-property-integer-access.cpp:92:31: note: in instantiation of function template specialization 'QtMocHelpers::assignFlags<QFlags<ClassWithFlagsAccessAsInteger::Flag>, unsigned int>' requested here
See-also: https://lists.qt-project.org/pipermail/development/2024-September/045636.html
Change-Id: I526db07389040483fc2efffd66895430a55ec62b
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We needed to go through two levels of indirection to generate it for
classes. First, it needs to be inside the context of the class or
namespace in question, hence the need for a qt_create_metaobjectdata()
member function. This is necessary because moc does not know what
context some property types are, like "Error": they may be a nested type
in the class or local to this namespace. Doing this also gains us access
to everything the class has access to. (The metatype array avoided this
problem by declaring the types as template parameters in the context of
the staticMetaObject, so it transitively gained the same access we now
do)
Second, because the class itself may be private, we need a way to call
the function we've just defined without naming it, so we insert a
template friend in Q_OBJECT & Q_GADGET, which we can define in the moc
output. We multiplex it using the 1:1 association with the token type
that moc already defines.
The member function is a template so no compiler will attempt to export
it. Moreover, our specialization is keyed to a type in an unnamed
namespace.
The changes to tst_QVariant are temporary, because it is abusing the
Q_ENUM marker on a 64-bit enumeration.
Task-number: QTBUG-111926
Change-Id: I8a96935cf6c742259c9dfffd17e951563adde9a1
Reviewed-by: Ahmad Samir <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generated moc files contain `using` which shadows the previous `_t`
in the `qt_static_metacall` function.
To fix this rename the `using _t`.
Example.:
In file included from /home/jonas/Projects/strawberry/build-qt6dev/src/mpris2_player.cpp:217:
/home/jonas/Projects/strawberry/build-qt6dev/src/moc_mpris2_player.cpp: In static member function ‘static void Mpris2Player::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)’:
/home/jonas/Projects/strawberry/build-qt6dev/src/moc_mpris2_player.cpp:266:19: warning: declaration of ‘using _t = void (class Mpris2Player::*)(qlonglong)’ shadows a previous local [-Wshadow]
266 | using _t = void (Mpris2Player::*)(qlonglong );
| ^~
/home/jonas/Projects/strawberry/build-qt6dev/src/moc_mpris2_player.cpp:247:11: note: shadowed declaration is here
247 | auto *_t = static_cast<Mpris2Player *>(_o);
| ^~
Pick-to: 6.8
Change-Id: I4a7d4e09ea599f3db97e21ae48599423f45885f5
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
We need it for the most common operations in this function
(InvokeMetaMethod and all the property operations), so this avoids
duplication and ensures we always compile the static_cast.
Pick-to: 6.8
Change-Id: I21b199bb5a1a1de632a3fffd45b339c2f3326100
Reviewed-by: Volker Hilsheimer <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit e816f915411a0f517021769abd8919a423f635c3 ("Moc: avoid double
underscores in a generated identifier") added the CLASS..SCOPE..ENDCLASS
mangling to avoid creating double underscores, which are reserved to the
compiler and thus undefined behavior for us to use.
This commit changes that mangling to something similar to the IA-64 C++
ABI because a) that creates shorter identifier names that are often
easier to read if you have to open the moc result and b) will not
collide with a class name by the user that used SCOPE in the name, such
as:
namespace Outer { class Inner { Q_GADGET }; }
class OuterSCOPEInner : public QObject { Q_OBJECT } };
Before:
Q_CONSTINIT static const uint qt_meta_data_CLASSOuterSCOPEInnerENDCLASS[] = {
Q_CONSTINIT static const uint qt_meta_data_CLASSOuterSCOPEInnerENDCLASS[] = {
Now:
Q_CONSTINIT static const uint qt_meta_data_ZN5Outer5InnerE[] =
Q_CONSTINIT static const uint qt_meta_data_ZN15OuterSCOPEInnerE[] =
While I make no promises that this matches the mangling scheme, it can
actually be decoded by the c++filt(1) tool. The main difference (AFAICT)
is that we use the N..E production even for types in the global
namespace (e.g., "QObject" mangling should be "7QObject" but is
"N7QObjectE").
$ c++filt _ZN42QTBUG32933_relatedObjectsDontIncludeItself2NS3ObjE
QTBUG32933_relatedObjectsDontIncludeItself::NS::Obj
Pick-to: 6.5 6.7 6.8
Change-Id: I40b756c1ac0f6a986d79fffd14b2e245ac195afb
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
| |
Because I'm pedantic.
Pick-to: 6.8
Change-Id: I3ac643db1a74864f0d69fffdebe7df6c6f1b1c28
Reviewed-by: Christian Ehrlicher <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By removing the attempt to write if () {} else if () chains. The _c
variable is a primitive (an enum) local to this function, so its value
cannot change. All compilers in 2024 are smart enough to realize that
if (_c == QMetaObject::CreateInstance) {
...
} else if (_c == QMetaObject::ReadProperty) {
...
} else if (_c == QMetaObject::WriteProperty) {
...
} else if (_c == QMetaObject::ResetProperty) {
} else if (_c == QMetaObject::BindableProperty) {
...
}
is the same as
if (_c == QMetaObject::CreateInstance) {
...
}
if (_c == QMetaObject::ReadProperty) {
...
}
if (_c == QMetaObject::WriteProperty) {
...
}
if (_c == QMetaObject::BindableProperty) {
...
}
Drive-by not emitting some of the unnecessary property controls (which
all compilers would discard anyway).
Pick-to: 6.8
Change-Id: Ib3e88392d7b960fbf64dfffd83ce636260ff6d7d
Reviewed-by: Ivan Solovev <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
It's an empty struct now, a.k.a. a "tag struct". It used to be the type
of the actual data prior to QtMocHelpers::stringData().
Pick-to: 6.8
Change-Id: I490a0b19e05103c74305fffd20c71a51e94fc449
Reviewed-by: Ivan Solovev <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of storing them as an array for every single method (some of
which may not have revisions) at a different location in the uint array,
store the revision after the parameter type and name lists, in the usual
place.
This is not implemented for the old integer table in moc, because it's
going away.
[ChangeLog][Important Behavior Changes] With Qt 6.9, the layout of the
meta object data table changed incompatibly for classes containing meta
methods (signals, slots) marked with Q_REVISION. This is marked by the
presence of revision 13 or later. Code that reads or writes the meta
object's raw data directly instead of using QMetaMethod must detect the
new layout.
Change-Id: I8a96935cf6c742259c9dfffd17e97a2530b52b3e
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
| |
Change-Id: I8a96935cf6c742259c9dfffd17e950a5230e2465
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Ahmad Samir <[email protected]>
|
|
|
|
|
|
|
|
| |
This is like qtmochelpers.h, but contains no code so can be used in moc
itself. Added because I will need to use the constants in moc.
Change-Id: I8a96935cf6c742259c9dfffd17ea660cad72a36d
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
| |
It was not matching up with the data there anymore,
the notifyID and 'p.revision' was not mentioned
Change-Id: I09f63e5137944e9ab96e0a70abb798895d4b7739
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The moc generated code does a sanity check that NOTIFY signals actually
exist in the parent class when they cannot be found in the class moc
currently runs on.
The logic there was however too simplistic, and couldn't deal with
signals taking a parameter.
Fix this, and take the opportunity to use a proper static_assert instead
of generating a "normal" compile error.
We do not do any checks for the presence of QPrivateSignal, as the whole
point of QPrivateSignal is that it should be private (and not e.g.
protected).
Moreover, we adjust QMetaProperty::notifySignalIndex to take
single-argument notify methods into consideration as well when
encontering an unresolved notify index.
Fixes: QTBUG-115989
Pick-to: 6.7
Change-Id: I8a056a15777f3132691e207b4b9ab6c2c9b2126d
Reviewed-by: Ivan Solovev <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
... with properly-named members.
This is in preparation of adding a new member in order to fix
QTBUG-101141 (namespaced base classes).
Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-101141
Change-Id: I2309e425ac94ad275b54a898fd33a2891e5d1453
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Because an unnamed namespace, and variables inside it, have internal
linkage[1]; and the variable is constexpr in this case so static
redundant.
This fixes a clang-tidy warning:
readability-static-definition-in-anonymous-namespace
[1] https://eel.is/c++draft/basic.link#4
Change-Id: I95600214cd51b03872ee22995d93d1b5658d5a18
Task-number: QTBUG-112870
Reviewed-by: Thiago Macieira <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
The concatenated byte array is already the "size" we want.
Drive-by change: use QByteArray::sliced()
Change-Id: Id0afb45ae1daf08bd125230eef0734770c645e1a
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Change Generator::generateSignal() to take by const FunctionDef*, so
that it can be called with the return of QList::at().
Change-Id: I5ffb0726a5ded6561e0000a2bea1973ada675152
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
| |
No need to copy the 3 QLists to iterate over them.
Change-Id: Id0fc7d39012bdaa78e51b1153565df77c7fb889a
Reviewed-by: Thiago Macieira <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
By handling the special case before entering the loop, then it can
become a range-for, which fixes a narrowing conversion warning, and it
becomes more readable.
Change-Id: I6ce0181c95eae01a4f2bb7cd12fb5cbeba378586
Reviewed-by: Thiago Macieira <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
| |
Change-Id: I20600357841aff36f68bcc9a81bfb3e96bf6e264
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
| |
Pick-to: 6.6 6.5
Change-Id: I6dee1a6ae82c33bd6523734ee32ab4c83835f9d8
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The alternative would be to explicitly cast each list.size() to int. I
think using iterators is a cleaner solution.
Drive-by changes:
- Give a std::pair's members better names than first/second, by using a
structured binding
- Port to qsizetype
Pick-to: 6.6 6.5
Change-Id: Icff3126192f9813fba698d5722b209307011ca48
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes an issue with generated code where the name of an enclosing
namespace is identical to an enum class type, when Q_ENUM_NS is used.
Consider:
namespace a {
Q_NAMESPACE
namespace b {
enum class b { Key, Key2 };
Q_ENUM_NS(b);
}
}
moc generated code such as:
Q_CONSTINIT const QMetaObject a::b::staticMetaObject = { {
...
qt_incomplete_metaTypeArray<qt_meta_stringdata_CLASSaSCOPEbENDCLASS_t,
// enum 'TestEnum'
QtPrivate::TypeAndForceComplete<b::b, std::true_type>,
// Q_OBJECT / Q_GADGET
QtPrivate::TypeAndForceComplete<void, std::true_type>
>,
nullptr
} };
which confused the compiler:
error: ‘b’ is not a member of ‘a::b::b
83 | QtPrivate::TypeAndForceComplete<b::b, std::true_type>,
Fixes: QTBUG-112996
Pick-to: 6.6
Change-Id: I37aee83c32efe96cc9d6c2bd0bdb9ba80bb7b8a7
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Parts of the public API, e.g. QMetaMethod::methodIndex and similar
functions return int, and other parts of the code expect int values, at
least for Qt6 this can't be changed, so use qsizetype internally and
assert the values fit in an int.
As pointed out in code review, not many people will build moc in debug
mode, so asserts aren't that useful here. Instead print error messages
and exit, like is already done in other parts of the code.
Change-Id: Id305165caa996c899f30770a757098fe2f9a96f6
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
| |
This way the Generator can use e.g. Parser::error() to print error
messages (which will happen in a later commit).
Change-Id: Id710d7b604a82ce6bb61999addad8c95c53e3226
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Assert generator.strings.size() < INT_MAX after all strings have been
registered.
Parts of the public API, e.g. QMetaMethod::methodIndex and similar
functions return int, and other parts of the code expect int values, at
least for Qt6 this can't be changed, so use qsizetype internally and
assert the values fit in an int.
Change-Id: Ib226e9c19a578bbeaeb9bb767d756a9569fe57b3
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
| |
Pick-to: 6.6 6.5
Change-Id: Id1094aaba284c51c3a840a8e107abd837a825593
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If QT_MOC_HAS_STRINGDATA isn't defined, just put an '#error' directive
in the generated code.
Since the proposal of doing ±4 versions of tool compatibility hasn't
been adopted, just remove the fallback string code. Requested by Thiago
in code review.
Drive-by changes:
- Use "STRINGDATA" in comments too
- Remove a now unused static helper
Change-Id: I6dbdf427b7219b8b32076a9e0a41799c0a476ff9
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
| |
Simple s/int/qsizetype/. Fixes some narrowing conversion warnings.
Pick-to: 6.5
Change-Id: Ied82e861298fa9763089cadc7eae6e536f1bb9ca
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
I.e. range-for and in one case QList::append(iterator, iterator).
Drive-by changes:
- Check a QByteArray isn't empty before using at()
- Shorten a long line, QString::fromLocal8Bit() works with QByteArray
Pick-to: 6.5
Change-Id: I7e54ce39f65ccb1fe5e60693ac98e239b9f0d794
Reviewed-by: Fabian Kosmale <[email protected]>
|