Commit Graph

8 Commits

Author SHA1 Message Date
Joerg Bornemann 415da4185f dumpcpp: Qualify type names
Changes in Qt 6.9's moc lead to compilation errors in dumpcpp's C++
output. There are two separate issues:

1. Type libraries may contain properties/methods that have the same name
as a type that's defined in the TLB. That led to a type vs member
conflict in moc's output. That's resolved in moc itself.

2. In moc's output, types that are declared in the TLB must be qualified
with the TLB's namespace to resolve name conflicts.

This patch does the latter:
When writing the in-memory header file that's passed to moc we qualify
types that belong to the type library with the type library's namespace.

Pick-to: 6.9 6.10
Fixes: QTBUG-136512
Fixes: QTBUG-137347
Change-Id: I27858f145261f0aee392bef46756691ae0360dd2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-20 08:04:04 +02:00
Oliver Wolff 8643688eed dumpcpp: Fix creation of temporary header
dumpcpp created "invalid" headers. These headers contained one closing
brace too many because we closed the "class scope" as a namespace.

Pick-to: 6.8 6.9
Change-Id: I06b94a0b1437c4994f710aa6d8a5a640d8c4ea39
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-01-22 11:28:09 +00:00
Thiago Macieira 6b727bc82f dumpcpp: clean up the cleaning up of moc output
moc does not generate either the "QtPrivate::TypeAndForceComplete<" or
the "uint(" code any more since qtbase commit
da4a6cf78ff42a4f69c2775997ff174ef647f3f3. This will match nothing, so
it's dead code. It also doesn't appear to be necessary any more, as
everything compiles.

There's no explanation of why this was needed in commit
b4d965231e.

Instead of cleaning up what moc is producing, we instead ask it to
produce ActiveQt-compliant code with the hidden --active-qt option.

This allows us to use the Q_OBJECT or Q_OBJECT_FAKE macros for full &
proper meta object, so the moc output matches the declarations. It was
missing the new qt_create_metaobjectdata() private template function
that moc is implementing. And if you don't declare it, then the moc
function won't work.

The function declaration works with both GCC and MSVC due to apparent
bugs (see https://conformance.godbolt.org/z/TEornTf5o).

Fixes: QTBUG-129724
Change-Id: I24a3e1cdcc2258791b13fffda65f2c8de0c450b9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-11-29 09:53:37 +01:00
Thiago Macieira 6444b6036d dumpcpp: remove the need for a temporary header file
moc can process stdin. When it does, it doesn't produce the #include
directive.

Change-Id: I95b0d396b67f47887addfffd0d16034a48171bf8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-10-11 23:27:54 -07:00
Marc Mutz 09b4615abc Port from <cctype> toupper() to QtMiscUtils::toAsciiUpper()
The C toupper function is locale-dependent. Given the right locale
(Türkiye, e.g.), toupper(i) is either

- İ (LATIN CAPITAL LETTER I WITH DOT ABOVE; if representable) or
- i (unchanged; if it isn't)

Both results are wrong for the use-cases at hand.

Task-number: QTBUG-109235
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Ia9726f0079c5f2625d97a341836b3d4505db6be1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
2022-12-23 21:01:17 +01:00
Lucie Gérard 2e7234cc40 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: Ibdefc58cad3b83d0d117fc333de76ccb5177a621
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-10 16:20:09 +02:00
Friedemann Kleint 417b438c96 Fix crash in dumpcpp-generated code
QWidget/QObject were generated as base classes for the generated class,
which is no longer correct after the introduction of the
QAxBaseWidget/Object classes. Pass the correct base QMetaObject and
simplify the code since there is always a base class now.

Pick-to: 6.1
Change-Id: I822f2de4ce65785cd45dc3b4adf1923efae556be
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-15 11:52:21 +01:00
Friedemann Kleint b4d965231e dumpcpp: Use moc to generate metaobject code
dumpcpp contained an old version of moc code, which is now out
of date. Write out the interface as C++ code and run the real
moc on it to generate this. Some modifications are required.

Remove some asserts that checked on an empty meta object
created in the fallback path of QAxBasePrivate::metaObject()
which was removed by
0bcdc74f55.

Task-number: QTBUG-82945
Change-Id: Ide58bae1440331ea4d5da0fcc74b41f49f09599a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-08 11:52:02 +02:00