Go to file
Thiago Macieira 7ceba9c472 moc: use C++ constexpr to generate the meta object string data
This avoids having to rely on moc precalculating everything and getting
its sums right, as the main integer table only has a string index
(unlike my original 5.0 plan which would have stored the offset).

For example, for:

  struct Object : QObject { Q_OBJECT signals: void changed(const QVariant &v); }

moc now generates:

  struct qt_meta_stringdata_Object_t {};
  static constexpr auto qt_meta_stringdata_Object = QtMocHelpers::stringData(
      "Object",
      "foobar",
      "",
      "v"
  );

Notes on the implementation:

* the old code is retained because we need moc 6.5 to generate code
  compatible with QtCore 6.2-6.4. It's marked for removal in Qt 6.9.
* the struct qt_meta_stringdata_%s_t remains because we need a
  TU-specific type for QtPrivate::is_complete (via
  qt_incomplete_metaTypeArray). This can be cleaned up.
* after this change, GDB complains while loading QtCore:
    warning: internal error: string "StringData<long sequence of numbers>" failed to be canonicalized
  but debugging does not appear to be impacted. It's just annoying
  because it shows up when QtTest detects a crash too.

Change-Id: Id0fb9ab0089845ee8843fffd16f9d5493e9bd708
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-04 12:50:12 -07:00
.github/workflows Repair github action workflow 2021-11-10 18:57:33 +01:00
bin Minor fixes for qt-configure-module 2022-06-27 17:55:19 +02:00
cmake CMake: Override simulator architecture to x86_64 for Xcode generator 2022-08-03 21:40:08 +02:00
coin Add license headers to cmake files 2022-08-03 17:14:55 +02:00
config.tests Add license headers to cmake files 2022-08-03 17:14:55 +02:00
dist Add Qt 6.0.0 changes file 2020-11-16 10:02:08 +02:00
doc Add license headers to cmake files 2022-08-03 17:14:55 +02:00
examples Add license headers to cmake files 2022-08-03 17:14:55 +02:00
lib Purge all fonts 2015-08-18 19:59:14 +00:00
libexec Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
LICENSES Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
mkspecs qmake: Link static plugins even in shared Qt builds 2022-07-25 18:02:37 +02:00
qmake Add license headers to cmake files 2022-08-03 17:14:55 +02:00
src moc: use C++ constexpr to generate the meta object string data 2022-08-04 12:50:12 -07:00
tests Fix initialization of QDateEdit and QTimeEdit 2022-08-04 20:39:52 +02:00
util CMake: Rewrite double-conversion find module 2022-07-02 00:11:12 +02:00
.cmake.conf Bump version to 6.5.0 2022-06-06 13:23:59 +03:00
.gitattributes Give batch files CRLF line endings 2020-11-04 15:02:29 +00:00
.gitignore Assume qhelpgenerator in libexec instead of bin 2021-11-08 19:27:32 +01:00
.lgtm.yml Skip LGTM analysis for the bootstrap library and tools 2020-07-16 01:04:34 +02:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
CMakeLists.txt Add license headers to cmake files 2022-08-03 17:14:55 +02:00
conanfile.py Conan: Do not force 'qt_host_path' usage in cross-build context 2022-06-22 18:18:42 +03:00
config_help.txt CMake: update the x86 intrinsic checks 2022-06-28 03:28:42 +00:00
configure Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
configure.bat Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
configure.cmake Add license headers to cmake files 2022-08-03 17:14:55 +02:00
dependencies.yaml Re-add dependencies.yaml now that qt5.git wip/qt6 builds fine 2019-09-18 13:19:31 +02:00
qt_cmdline.cmake Add license headers to cmake files 2022-08-03 17:14:55 +02:00
sync.profile Remove deprecated qgl.h from sync.profile 2022-06-11 00:42:13 +02:00