diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2019-12-11 12:18:58 +0100 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2020-02-20 16:11:02 +0100 |
commit | 3c0cd7566cf858d0fd23fecad5ef9faec798cf5f (patch) | |
tree | ae308b254b2364df7e75abc50277770e3ad250e5 /src/corelib/kernel/qmetatype.h | |
parent | 4dbac23e5354638224d8d99ba3342067c015a04b (diff) |
Export an extern template for QMetaTypeForType for builtin types
That way not every translation unit generates the QMetaTypeInterface
for the builtin types
Change-Id: Id703c14532646a58f4088e8f3914564ce35e398e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qmetatype.h')
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 7ee6a2662d..f9d7fe9f03 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -2723,6 +2723,24 @@ QMetaTypeInterface QMetaTypeForType<T>::metaType = { template<typename T> constexpr const decltype(typenameHelper<T>()) QMetaTypeForType<T>::name = typenameHelper<T>(); +template<> +class QMetaTypeForType<void> +{ +}; + +#ifndef QT_BOOTSTRAPPED +#define QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER(TypeName, Id, Name) \ + extern template class Q_CORE_EXPORT QMetaTypeForType<Name>; +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wattributes") // false positive because of QMetaTypeForType<void> +QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +QT_WARNING_POP +QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +QT_FOR_EACH_STATIC_CORE_CLASS(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +QT_FOR_EACH_STATIC_CORE_POINTER(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +QT_FOR_EACH_STATIC_CORE_TEMPLATE(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +#undef QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER +#endif template<typename T> constexpr QMetaTypeInterface *qMetaTypeIntefaceForType() |