summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-08-20 18:31:06 +0200
committerLars Knoll <lars.knoll@qt.io>2020-08-26 01:03:22 +0200
commitacbf9a858b6b389103b7f43f4f4892a142ec56c6 (patch)
tree1c5e7feae0cd6999e37fca0644d152c76d29a790
parentdb21bad936a761f475145886f1e06dfcfa11eb80 (diff)
Cleanup QTypeInfo
Remove QTypeInfo::isStatic, as that's not used anymore in Qt 6. Also remove sizeOf, it's unused, and we have QMetaType for that if required. Remove all typeinfo declaractions for trivial types, as the default template covers them correctly nowadays. Finally set up a better default for isPointer, and do some smaller cleanups all over the place. Change-Id: I6758ed37dfc701feaaf0ff105cc95e32da9f9c33 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/global/qtypeinfo.h129
-rw-r--r--src/corelib/kernel/qmetatype.h2
-rw-r--r--src/corelib/tools/qarraydataops.h8
-rw-r--r--src/corelib/tools/qcontainertools_impl.h4
-rw-r--r--src/corelib/tools/qvarlengtharray.h4
-rw-r--r--src/gui/math3d/qgenericmatrix.h8
-rw-r--r--tests/auto/corelib/global/qflags/tst_qflags.cpp4
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp11
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp4
-rw-r--r--tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp2
-rw-r--r--tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp9
-rw-r--r--tests/auto/corelib/tools/qlist/tst_qlist.cpp12
-rw-r--r--tests/auto/corelib/tools/qpair/tst_qpair.cpp20
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp6
-rw-r--r--tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp2
-rw-r--r--tests/benchmarks/corelib/tools/qvector/qrawvector.h4
16 files changed, 62 insertions, 167 deletions
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h
index e45347ee10..30db5c4487 100644
--- a/src/corelib/global/qtypeinfo.h
+++ b/src/corelib/global/qtypeinfo.h
@@ -55,16 +55,7 @@ class QDebug;
*/
template <typename T>
-static constexpr bool qIsRelocatable()
-{
- return std::is_trivially_copyable<T>::value && std::is_trivially_destructible<T>::value;
-}
-
-template <typename T>
-static constexpr bool qIsTrivial()
-{
- return std::is_trivial<T>::value;
-}
+static constexpr bool qIsRelocatable = std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<T>;
/*
The catch-all template.
@@ -75,12 +66,10 @@ class QTypeInfo
{
public:
enum {
- isPointer = false,
- isIntegral = std::is_integral<T>::value,
- isComplex = !qIsTrivial<T>(),
- isStatic = true,
- isRelocatable = qIsRelocatable<T>(),
- sizeOf = sizeof(T)
+ isPointer = std::is_pointer_v<T>,
+ isIntegral = std::is_integral_v<T>,
+ isComplex = !std::is_trivial_v<T>,
+ isRelocatable = qIsRelocatable<T>,
};
};
@@ -92,53 +81,11 @@ public:
isPointer = false,
isIntegral = false,
isComplex = false,
- isStatic = false,
isRelocatable = false,
- sizeOf = 0
- };
-};
-
-template <typename T>
-class QTypeInfo<T*>
-{
-public:
- enum {
- isPointer = true,
- isIntegral = false,
- isComplex = false,
- isStatic = false,
- isRelocatable = true,
- sizeOf = sizeof(T*)
};
};
/*!
- \class QTypeInfoQuery
- \inmodule QtCore
- \internal
- \brief QTypeInfoQuery is used to query the values of a given QTypeInfo<T>
-
- We use it because there may be some QTypeInfo<T> specializations in user
- code that don't provide certain flags that we added after Qt 5.0. They are:
- \list
- \li isRelocatable: defaults to !isStatic
- \endlist
-
- DO NOT specialize this class elsewhere.
-*/
-// apply defaults for a generic QTypeInfo<T> that didn't provide the new values
-template <typename T, typename = void>
-struct QTypeInfoQuery : public QTypeInfo<T>
-{
- enum { isRelocatable = !QTypeInfo<T>::isStatic };
-};
-
-// if QTypeInfo<T>::isRelocatable exists, use it
-template <typename T>
-struct QTypeInfoQuery<T, typename std::enable_if<QTypeInfo<T>::isRelocatable || true>::type> : public QTypeInfo<T>
-{};
-
-/*!
\class QTypeInfoMerger
\inmodule QtCore
\internal
@@ -163,12 +110,10 @@ class QTypeInfoMerger
{
static_assert(sizeof...(Ts) > 0);
public:
- static constexpr bool isComplex = ((QTypeInfoQuery<Ts>::isComplex) || ...);
- static constexpr bool isStatic = ((QTypeInfoQuery<Ts>::isStatic) || ...);
- static constexpr bool isRelocatable = ((QTypeInfoQuery<Ts>::isRelocatable) && ...);
+ static constexpr bool isComplex = ((QTypeInfo<Ts>::isComplex) || ...);
+ static constexpr bool isRelocatable = ((QTypeInfo<Ts>::isRelocatable) && ...);
static constexpr bool isPointer = false;
static constexpr bool isIntegral = false;
- static constexpr std::size_t sizeOf = sizeof(T);
};
#define Q_DECLARE_MOVABLE_CONTAINER(CONTAINER) \
@@ -182,8 +127,6 @@ public: \
isIntegral = false, \
isComplex = true, \
isRelocatable = true, \
- isStatic = false, \
- sizeOf = sizeof(CONTAINER<T>) \
}; \
}
@@ -204,9 +147,7 @@ public: \
isPointer = false, \
isIntegral = false, \
isComplex = true, \
- isStatic = false, \
isRelocatable = true, \
- sizeOf = sizeof(CONTAINER<K, V>) \
}; \
}
@@ -228,10 +169,9 @@ Q_DECLARE_MOVABLE_CONTAINER(QMultiHash);
enum { /* TYPEINFO flags */
Q_COMPLEX_TYPE = 0,
Q_PRIMITIVE_TYPE = 0x1,
- Q_STATIC_TYPE = 0,
- Q_MOVABLE_TYPE = 0x2, // ### Qt6: merge movable and relocatable once QList no longer depends on it
+ Q_RELOCATABLE_TYPE = 0x2,
+ Q_MOVABLE_TYPE = 0x2,
Q_DUMMY_TYPE = 0x4,
- Q_RELOCATABLE_TYPE = 0x8
};
#define Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) \
@@ -239,14 +179,11 @@ class QTypeInfo<TYPE > \
{ \
public: \
enum { \
- isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !qIsTrivial<TYPE>(), \
- isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \
- isRelocatable = !isStatic || ((FLAGS) & Q_RELOCATABLE_TYPE) || qIsRelocatable<TYPE>(), \
+ isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !std::is_trivial_v<TYPE>, \
+ isRelocatable = !isComplex || ((FLAGS) & Q_RELOCATABLE_TYPE) || qIsRelocatable<TYPE>, \
isPointer = false, \
isIntegral = std::is_integral< TYPE >::value, \
- sizeOf = sizeof(TYPE) \
}; \
- static inline const char *name() { return #TYPE; } \
}
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS) \
@@ -283,50 +220,6 @@ inline void swap(TYPE &value1, TYPE &value2) \
#define Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(TYPE) \
Q_DECLARE_SHARED_IMPL(TYPE, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_MOVABLE_TYPE : Q_RELOCATABLE_TYPE)
-/*
- QTypeInfo primitive specializations
-*/
-Q_DECLARE_TYPEINFO(bool, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(char, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(signed char, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(uchar, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(short, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(ushort, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(int, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(uint, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(long, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(ulong, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(qint64, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(quint64, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(float, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(double, Q_PRIMITIVE_TYPE);
-
-#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
-// ### Qt 6: remove the other branch
-// This was required so that QList<T> for these types allocates out of the array storage
-Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE);
-# ifdef Q_COMPILER_UNICODE_STRINGS
-Q_DECLARE_TYPEINFO(char16_t, Q_PRIMITIVE_TYPE);
-Q_DECLARE_TYPEINFO(char32_t, Q_PRIMITIVE_TYPE);
-# endif
-# if !defined(Q_CC_MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
-Q_DECLARE_TYPEINFO(wchar_t, Q_PRIMITIVE_TYPE);
-# endif
-#else
-# ifndef Q_OS_DARWIN
-Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE);
-# else
-Q_DECLARE_TYPEINFO(long double, Q_RELOCATABLE_TYPE);
-# endif
-# ifdef Q_COMPILER_UNICODE_STRINGS
-Q_DECLARE_TYPEINFO(char16_t, Q_RELOCATABLE_TYPE);
-Q_DECLARE_TYPEINFO(char32_t, Q_RELOCATABLE_TYPE);
-# endif
-# if !defined(Q_CC_MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
-Q_DECLARE_TYPEINFO(wchar_t, Q_RELOCATABLE_TYPE);
-# endif
-#endif // Qt 6
-
namespace QTypeTraits
{
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index bf76f39a2a..cfc5f06c90 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -1459,7 +1459,7 @@ namespace QtPrivate {
template<typename T>
struct QMetaTypeTypeFlags
{
- enum { Flags = (QTypeInfoQuery<T>::isRelocatable ? QMetaType::MovableType : 0)
+ enum { Flags = (QTypeInfo<T>::isRelocatable ? QMetaType::MovableType : 0)
| (QTypeInfo<T>::isComplex ? QMetaType::NeedsConstruction : 0)
| (QTypeInfo<T>::isComplex ? QMetaType::NeedsDestruction : 0)
| (IsPointerToTypeDerivedFromQObject<T>::Value ? QMetaType::PointerToQObject : 0)
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index f787dacfac..f6384ca998 100644
--- a/src/corelib/tools/qarraydataops.h
+++ b/src/corelib/tools/qarraydataops.h
@@ -174,7 +174,7 @@ struct QArrayExceptionSafetyPrimitives
T *const end;
qsizetype displace;
- static_assert(QTypeInfoQuery<T>::isRelocatable, "Type must be relocatable");
+ static_assert(QTypeInfo<T>::isRelocatable, "Type must be relocatable");
Displacer(T *start, T *finish, qsizetype diff) noexcept
: begin(start), end(finish), displace(diff)
@@ -201,7 +201,7 @@ struct QArrayExceptionSafetyPrimitives
size_t n;
qsizetype &size;
- static_assert(QTypeInfoQuery<T>::isRelocatable, "Type must be relocatable");
+ static_assert(QTypeInfo<T>::isRelocatable, "Type must be relocatable");
Mover(T *&start, size_t length, qsizetype &sz) noexcept
: destination(start), source(start), n(length), size(sz)
@@ -1018,7 +1018,7 @@ struct QArrayOpsSelector
template <class T>
struct QArrayOpsSelector<T,
typename std::enable_if<
- !QTypeInfoQuery<T>::isComplex && QTypeInfoQuery<T>::isRelocatable
+ !QTypeInfo<T>::isComplex && QTypeInfo<T>::isRelocatable
>::type>
{
typedef QPodArrayOps<T> Type;
@@ -1027,7 +1027,7 @@ struct QArrayOpsSelector<T,
template <class T>
struct QArrayOpsSelector<T,
typename std::enable_if<
- QTypeInfoQuery<T>::isComplex && QTypeInfoQuery<T>::isRelocatable
+ QTypeInfo<T>::isComplex && QTypeInfo<T>::isRelocatable
>::type>
{
typedef QMovableArrayOps<T> Type;
diff --git a/src/corelib/tools/qcontainertools_impl.h b/src/corelib/tools/qcontainertools_impl.h
index 44cfdc444e..a7e1aa31cd 100644
--- a/src/corelib/tools/qcontainertools_impl.h
+++ b/src/corelib/tools/qcontainertools_impl.h
@@ -61,7 +61,7 @@ namespace QtPrivate
template <typename T, typename N>
void q_uninitialized_relocate_n(T* first, N n, T* out)
{
- if constexpr (QTypeInfoQuery<T>::isRelocatable) {
+ if constexpr (QTypeInfo<T>::isRelocatable) {
if (n != N(0)) { // even if N == 0, out == nullptr or first == nullptr are UB for memmove()
std::memmove(static_cast<void*>(out),
static_cast<const void*>(first),
@@ -69,7 +69,7 @@ void q_uninitialized_relocate_n(T* first, N n, T* out)
}
} else {
std::uninitialized_move_n(first, n, out);
- if constexpr (QTypeInfoQuery<T>::isComplex)
+ if constexpr (QTypeInfo<T>::isComplex)
std::destroy_n(first, n);
}
}
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index a70fc75fcf..01571e3e9f 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -429,7 +429,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(qsizetype asize,
a = Prealloc;
}
s = 0;
- if (!QTypeInfoQuery<T>::isRelocatable) {
+ if (!QTypeInfo<T>::isRelocatable) {
QT_TRY {
// move all the old elements
while (s < copySize) {
@@ -556,7 +556,7 @@ Q_OUTOFLINE_TEMPLATE typename QVarLengthArray<T, Prealloc>::iterator QVarLengthA
if (n != 0) {
resize(s + n);
const T copy(t);
- if (!QTypeInfoQuery<T>::isRelocatable) {
+ if (!QTypeInfo<T>::isRelocatable) {
T *b = ptr + offset;
T *j = ptr + s;
T *i = j - n;
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index 81fc9eee62..1381014a04 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -108,12 +108,6 @@ template <int N, int M, typename T>
class QTypeInfo<QGenericMatrix<N, M, T> >
: public QTypeInfoMerger<QGenericMatrix<N, M, T>, T>
{
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-public:
- enum {
- isStatic = true,
- }; // at least Q_RELOCATABLE_TYPE, for BC during Qt 5
-#endif
};
template <int N, int M, typename T>
@@ -350,7 +344,7 @@ QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T> &m)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QGenericMatrix<" << N << ", " << M
- << ", " << QTypeInfo<T>::name()
+ << ", " << QMetaType::fromType<T>().name()
<< ">(" << Qt::endl << qSetFieldWidth(10);
for (int row = 0; row < M; ++row) {
for (int col = 0; col < N; ++col)
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp
index 64afdaf352..521e134767 100644
--- a/tests/auto/corelib/global/qflags/tst_qflags.cpp
+++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp
@@ -152,7 +152,7 @@ enum class MyStrictNoOpEnum { StrictZero, StrictOne, StrictTwo, StrictFour=4 };
Q_DECLARE_FLAGS( MyStrictNoOpFlags, MyStrictNoOpEnum )
static_assert( !QTypeInfo<MyStrictFlags>::isComplex );
-static_assert( !QTypeInfo<MyStrictFlags>::isStatic );
+static_assert( QTypeInfo<MyStrictFlags>::isRelocatable );
static_assert( !QTypeInfo<MyStrictFlags>::isPointer );
void tst_QFlags::classEnum()
@@ -322,7 +322,7 @@ Q_DECLARE_FLAGS( MyFlags, MyEnum )
Q_DECLARE_OPERATORS_FOR_FLAGS( MyFlags )
static_assert( !QTypeInfo<MyFlags>::isComplex );
-static_assert( !QTypeInfo<MyFlags>::isStatic );
+static_assert( QTypeInfo<MyFlags>::isRelocatable );
static_assert( !QTypeInfo<MyFlags>::isPointer );
QTEST_MAIN(tst_QFlags)
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 42d8d37583..e97dacea5f 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -919,6 +919,11 @@ FOR_EACH_CORE_METATYPE(RETURN_CREATE_COPY_FUNCTION)
TypeTestFunctionGetter::get(type)();
}
+template<typename T>
+constexpr size_t getSize = sizeof(T);
+template<>
+constexpr size_t getSize<void> = 0;
+
void tst_QMetaType::sizeOf_data()
{
QTest::addColumn<int>("type");
@@ -926,7 +931,7 @@ void tst_QMetaType::sizeOf_data()
QTest::newRow("QMetaType::UnknownType") << int(QMetaType::UnknownType) << size_t(0);
#define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \
- QTest::newRow(#RealType) << int(QMetaType::MetaTypeName) << size_t(QTypeInfo<RealType>::sizeOf);
+ QTest::newRow(#RealType) << int(QMetaType::MetaTypeName) << getSize<RealType>;
FOR_EACH_CORE_METATYPE(ADD_METATYPE_TEST_ROW)
#undef ADD_METATYPE_TEST_ROW
@@ -1074,8 +1079,8 @@ void tst_QMetaType::flags_data()
#define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \
QTest::newRow(#RealType) << MetaTypeId \
- << bool(QTypeInfoQuery<RealType>::isRelocatable) \
- << bool(QTypeInfoQuery<RealType>::isComplex) \
+ << bool(QTypeInfo<RealType>::isRelocatable) \
+ << bool(QTypeInfo<RealType>::isComplex) \
<< bool(QtPrivate::IsPointerToTypeDerivedFromQObject<RealType>::Value) \
<< bool(std::is_enum<RealType>::value);
QT_FOR_EACH_STATIC_CORE_CLASS(ADD_METATYPE_TEST_ROW)
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index b871bfcac9..5fa06c4f46 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -3187,7 +3187,7 @@ template<class T> void playWithVariant(const T &orig, bool isNull, const QString
{
QVariant v2 = v;
- if (!(QTypeInfo<T>::isStatic && QTypeInfo<T>::isComplex)) {
+ if (QTypeInfo<T>::isRelocatable) {
// Type is movable so standard comparison algorithm in QVariant should work
// In a custom type QVariant is not aware of ==operator so it won't be called,
// which may cause problems especially visible when using a not-movable type
@@ -3204,7 +3204,7 @@ template<class T> void playWithVariant(const T &orig, bool isNull, const QString
v = QVariant();
QCOMPARE(v3, v);
v = v2;
- if (!(QTypeInfo<T>::isStatic && QTypeInfo<T>::isComplex)) {
+ if (QTypeInfo<T>::isRelocatable) {
// Type is movable so standard comparison algorithm in QVariant should work
// In a custom type QVariant is not aware of ==operator so it won't be called,
// which may cause problems especially visible when using a not-movable type
diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
index 0d467cc364..308b60d83b 100644
--- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
@@ -1880,7 +1880,7 @@ void tst_QByteArray::movablity()
{
QFETCH(QByteArray, array);
- static_assert(!QTypeInfo<QByteArray>::isStatic);
+ static_assert(QTypeInfo<QByteArray>::isRelocatable);
const int size = array.size();
const bool isEmpty = array.isEmpty();
diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
index efec562ba9..0172927042 100644
--- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
+++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
@@ -800,9 +800,12 @@ void tst_QArrayData::arrayOps()
};
const CountedObject objArray[5];
- QVERIFY(!QTypeInfo<int>::isComplex && !QTypeInfo<int>::isStatic);
- QVERIFY(QTypeInfo<QString>::isComplex && !QTypeInfo<QString>::isStatic);
- QVERIFY(QTypeInfo<CountedObject>::isComplex && QTypeInfo<CountedObject>::isStatic);
+ static_assert(!QTypeInfo<int>::isComplex);
+ static_assert(QTypeInfo<int>::isRelocatable);
+ static_assert(QTypeInfo<QString>::isComplex);
+ static_assert(QTypeInfo<QString>::isRelocatable);
+ static_assert(QTypeInfo<CountedObject>::isComplex);
+ static_assert(!QTypeInfo<CountedObject>::isRelocatable);
QCOMPARE(CountedObject::liveCount, size_t(5));
for (size_t i = 0; i < 5; ++i)
diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
index 56651ae474..f37633b64c 100644
--- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp
+++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
@@ -184,11 +184,11 @@ inline size_t qHash(const Custom &key, size_t seed = 0) { return qHash(key.i, se
Q_DECLARE_METATYPE(Custom);
// tests depends on the fact that:
-static_assert(!QTypeInfo<int>::isStatic);
+static_assert(QTypeInfo<int>::isRelocatable);
static_assert(!QTypeInfo<int>::isComplex);
-static_assert(!QTypeInfo<Movable>::isStatic);
+static_assert(QTypeInfo<Movable>::isRelocatable);
static_assert(QTypeInfo<Movable>::isComplex);
-static_assert(QTypeInfo<Custom>::isStatic);
+static_assert(!QTypeInfo<Custom>::isRelocatable);
static_assert(QTypeInfo<Custom>::isComplex);
@@ -2144,7 +2144,7 @@ void tst_QList::resizePOD_data() const
QTest::addColumn<int>("size");
QVERIFY(!QTypeInfo<int>::isComplex);
- QVERIFY(!QTypeInfo<int>::isStatic);
+ QVERIFY(QTypeInfo<int>::isRelocatable);
QList<int> null;
QList<int> empty(0, 5);
@@ -2192,7 +2192,7 @@ void tst_QList::resizeComplexMovable_data() const
QTest::addColumn<int>("size");
QVERIFY(QTypeInfo<Movable>::isComplex);
- QVERIFY(!QTypeInfo<Movable>::isStatic);
+ QVERIFY(QTypeInfo<Movable>::isRelocatable);
QList<Movable> null;
QList<Movable> empty(0, 'Q');
@@ -2244,7 +2244,7 @@ void tst_QList::resizeComplex_data() const
QTest::addColumn<int>("size");
QVERIFY(QTypeInfo<Custom>::isComplex);
- QVERIFY(QTypeInfo<Custom>::isStatic);
+ QVERIFY(!QTypeInfo<Custom>::isRelocatable);
QList<Custom> null;
QList<Custom> empty(0, '0');
diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp
index 70caa055b6..70808e3e48 100644
--- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp
+++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp
@@ -43,7 +43,7 @@ private Q_SLOTS:
void testDeductionRules();
};
-class C { C() {} Q_DECL_UNUSED_MEMBER char _[4]; };
+class C { C() {} ~C() {} Q_DECL_UNUSED_MEMBER char _[4]; };
class M { M() {} Q_DECL_UNUSED_MEMBER char _[4]; };
class P { Q_DECL_UNUSED_MEMBER char _[4]; };
@@ -64,31 +64,31 @@ typedef QPair<P,M> QPairPM;
typedef QPair<P,P> QPairPP;
static_assert( QTypeInfo<QPairCC>::isComplex);
-static_assert( QTypeInfo<QPairCC>::isStatic );
+static_assert( !QTypeInfo<QPairCC>::isRelocatable );
static_assert( QTypeInfo<QPairCM>::isComplex);
-static_assert( QTypeInfo<QPairCM>::isStatic );
+static_assert( !QTypeInfo<QPairCM>::isRelocatable );
static_assert( QTypeInfo<QPairCP>::isComplex);
-static_assert( QTypeInfo<QPairCP>::isStatic );
+static_assert( !QTypeInfo<QPairCP>::isRelocatable );
static_assert( QTypeInfo<QPairMC>::isComplex);
-static_assert( QTypeInfo<QPairMC>::isStatic );
+static_assert( !QTypeInfo<QPairMC>::isRelocatable );
static_assert( QTypeInfo<QPairMM>::isComplex);
-static_assert(!QTypeInfo<QPairMM>::isStatic );
+static_assert( QTypeInfo<QPairMM>::isRelocatable );
static_assert( QTypeInfo<QPairMP>::isComplex);
-static_assert(!QTypeInfo<QPairMP>::isStatic );
+static_assert( QTypeInfo<QPairMP>::isRelocatable );
static_assert( QTypeInfo<QPairPC>::isComplex);
-static_assert( QTypeInfo<QPairPC>::isStatic );
+static_assert( !QTypeInfo<QPairPC>::isRelocatable );
static_assert( QTypeInfo<QPairPM>::isComplex);
-static_assert(!QTypeInfo<QPairPM>::isStatic );
+static_assert( QTypeInfo<QPairPM>::isRelocatable );
static_assert(!QTypeInfo<QPairPP>::isComplex);
-static_assert(!QTypeInfo<QPairPP>::isStatic );
+static_assert( QTypeInfo<QPairPP>::isRelocatable );
static_assert(!QTypeInfo<QPairPP>::isPointer);
diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
index 3a504177db..5c5ccf0a21 100644
--- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -528,11 +528,11 @@ void reallocTest()
typedef QVarLengthArray<T, 16> Container;
enum {
- isStatic = QTypeInfo<T>::isStatic,
+ isRelocatable = QTypeInfo<T>::isRelocatable,
isComplex = QTypeInfo<T>::isComplex,
- isPrimitive = !isComplex && !isStatic,
- isMovable = !isStatic
+ isPrimitive = !isComplex && isRelocatable,
+ isMovable = isRelocatable
};
// Constructors
diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index 670b271d54..be34fa7639 100644
--- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -325,7 +325,7 @@ void tst_QGuiMetaType::flags_data()
QTest::addColumn<bool>("isComplex");
#define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \
- QTest::newRow(#RealType) << MetaTypeId << bool(QTypeInfoQuery<RealType>::isRelocatable) << bool(QTypeInfoQuery<RealType>::isComplex);
+ QTest::newRow(#RealType) << MetaTypeId << bool(QTypeInfo<RealType>::isRelocatable) << bool(QTypeInfo<RealType>::isComplex);
QT_FOR_EACH_STATIC_GUI_CLASS(ADD_METATYPE_TEST_ROW)
#undef ADD_METATYPE_TEST_ROW
}
diff --git a/tests/benchmarks/corelib/tools/qvector/qrawvector.h b/tests/benchmarks/corelib/tools/qvector/qrawvector.h
index ce718b69ea..1f615f6e69 100644
--- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h
+++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h
@@ -361,7 +361,7 @@ void QRawVector<T>::realloc(int asize, int aalloc, bool ref)
T *xbegin = m_begin;
if (aalloc != xalloc || ref) {
// (re)allocate memory
- if (QTypeInfo<T>::isStatic) {
+ if (!QTypeInfo<T>::isRelocatable) {
xbegin = allocate(aalloc);
xsize = 0;
changed = true;
@@ -462,7 +462,7 @@ typename QRawVector<T>::iterator QRawVector<T>::insert(iterator before, size_typ
const T copy(t);
if (m_size + n > m_alloc)
realloc(m_size, QVectorData::grow(offsetOfTypedData(), m_size + n, sizeof(T)), false);
- if (QTypeInfo<T>::isStatic) {
+ if (!QTypeInfo<T>::isRelocatable) {
T *b = m_begin + m_size;
T *i = m_begin + m_size + n;
while (i != b)