diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index e45347ee10f..30db5c44878 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -55,16 +55,7 @@ class QDebug; */ template -static constexpr bool qIsRelocatable() -{ - return std::is_trivially_copyable::value && std::is_trivially_destructible::value; -} - -template -static constexpr bool qIsTrivial() -{ - return std::is_trivial::value; -} +static constexpr bool qIsRelocatable = std::is_trivially_copyable_v && std::is_trivially_destructible_v; /* The catch-all template. @@ -75,12 +66,10 @@ class QTypeInfo { public: enum { - isPointer = false, - isIntegral = std::is_integral::value, - isComplex = !qIsTrivial(), - isStatic = true, - isRelocatable = qIsRelocatable(), - sizeOf = sizeof(T) + isPointer = std::is_pointer_v, + isIntegral = std::is_integral_v, + isComplex = !std::is_trivial_v, + isRelocatable = qIsRelocatable, }; }; @@ -92,52 +81,10 @@ public: isPointer = false, isIntegral = false, isComplex = false, - isStatic = false, isRelocatable = false, - sizeOf = 0 }; }; -template -class QTypeInfo -{ -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 - - We use it because there may be some QTypeInfo 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 that didn't provide the new values -template -struct QTypeInfoQuery : public QTypeInfo -{ - enum { isRelocatable = !QTypeInfo::isStatic }; -}; - -// if QTypeInfo::isRelocatable exists, use it -template -struct QTypeInfoQuery::isRelocatable || true>::type> : public QTypeInfo -{}; - /*! \class QTypeInfoMerger \inmodule QtCore @@ -163,12 +110,10 @@ class QTypeInfoMerger { static_assert(sizeof...(Ts) > 0); public: - static constexpr bool isComplex = ((QTypeInfoQuery::isComplex) || ...); - static constexpr bool isStatic = ((QTypeInfoQuery::isStatic) || ...); - static constexpr bool isRelocatable = ((QTypeInfoQuery::isRelocatable) && ...); + static constexpr bool isComplex = ((QTypeInfo::isComplex) || ...); + static constexpr bool isRelocatable = ((QTypeInfo::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) \ }; \ } @@ -204,9 +147,7 @@ public: \ isPointer = false, \ isIntegral = false, \ isComplex = true, \ - isStatic = false, \ isRelocatable = true, \ - sizeOf = sizeof(CONTAINER) \ }; \ } @@ -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 \ { \ public: \ enum { \ - isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !qIsTrivial(), \ - isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \ - isRelocatable = !isStatic || ((FLAGS) & Q_RELOCATABLE_TYPE) || qIsRelocatable(), \ + isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !std::is_trivial_v, \ + isRelocatable = !isComplex || ((FLAGS) & Q_RELOCATABLE_TYPE) || qIsRelocatable, \ 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 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 bf76f39a2ac..cfc5f06c901 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -1459,7 +1459,7 @@ namespace QtPrivate { template struct QMetaTypeTypeFlags { - enum { Flags = (QTypeInfoQuery::isRelocatable ? QMetaType::MovableType : 0) + enum { Flags = (QTypeInfo::isRelocatable ? QMetaType::MovableType : 0) | (QTypeInfo::isComplex ? QMetaType::NeedsConstruction : 0) | (QTypeInfo::isComplex ? QMetaType::NeedsDestruction : 0) | (IsPointerToTypeDerivedFromQObject::Value ? QMetaType::PointerToQObject : 0) diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index f787dacfacb..f6384ca9986 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::isRelocatable, "Type must be relocatable"); + static_assert(QTypeInfo::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::isRelocatable, "Type must be relocatable"); + static_assert(QTypeInfo::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 struct QArrayOpsSelector::isComplex && QTypeInfoQuery::isRelocatable + !QTypeInfo::isComplex && QTypeInfo::isRelocatable >::type> { typedef QPodArrayOps Type; @@ -1027,7 +1027,7 @@ struct QArrayOpsSelector struct QArrayOpsSelector::isComplex && QTypeInfoQuery::isRelocatable + QTypeInfo::isComplex && QTypeInfo::isRelocatable >::type> { typedef QMovableArrayOps Type; diff --git a/src/corelib/tools/qcontainertools_impl.h b/src/corelib/tools/qcontainertools_impl.h index 44cfdc444e2..a7e1aa31cdf 100644 --- a/src/corelib/tools/qcontainertools_impl.h +++ b/src/corelib/tools/qcontainertools_impl.h @@ -61,7 +61,7 @@ namespace QtPrivate template void q_uninitialized_relocate_n(T* first, N n, T* out) { - if constexpr (QTypeInfoQuery::isRelocatable) { + if constexpr (QTypeInfo::isRelocatable) { if (n != N(0)) { // even if N == 0, out == nullptr or first == nullptr are UB for memmove() std::memmove(static_cast(out), static_cast(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::isComplex) + if constexpr (QTypeInfo::isComplex) std::destroy_n(first, n); } } diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index a70fc75fcfd..01571e3e9ff 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -429,7 +429,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray::realloc(qsizetype asize, a = Prealloc; } s = 0; - if (!QTypeInfoQuery::isRelocatable) { + if (!QTypeInfo::isRelocatable) { QT_TRY { // move all the old elements while (s < copySize) { @@ -556,7 +556,7 @@ Q_OUTOFLINE_TEMPLATE typename QVarLengthArray::iterator QVarLengthA if (n != 0) { resize(s + n); const T copy(t); - if (!QTypeInfoQuery::isRelocatable) { + if (!QTypeInfo::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 81fc9eee623..1381014a046 100644 --- a/src/gui/math3d/qgenericmatrix.h +++ b/src/gui/math3d/qgenericmatrix.h @@ -108,12 +108,6 @@ template class QTypeInfo > : public QTypeInfoMerger, 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 @@ -350,7 +344,7 @@ QDebug operator<<(QDebug dbg, const QGenericMatrix &m) { QDebugStateSaver saver(dbg); dbg.nospace() << "QGenericMatrix<" << N << ", " << M - << ", " << QTypeInfo::name() + << ", " << QMetaType::fromType().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 64afdaf3521..521e1347678 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::isComplex ); -static_assert( !QTypeInfo::isStatic ); +static_assert( QTypeInfo::isRelocatable ); static_assert( !QTypeInfo::isPointer ); void tst_QFlags::classEnum() @@ -322,7 +322,7 @@ Q_DECLARE_FLAGS( MyFlags, MyEnum ) Q_DECLARE_OPERATORS_FOR_FLAGS( MyFlags ) static_assert( !QTypeInfo::isComplex ); -static_assert( !QTypeInfo::isStatic ); +static_assert( QTypeInfo::isRelocatable ); static_assert( !QTypeInfo::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 42d8d37583e..e97dacea5fe 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 +constexpr size_t getSize = sizeof(T); +template<> +constexpr size_t getSize = 0; + void tst_QMetaType::sizeOf_data() { QTest::addColumn("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::sizeOf); + QTest::newRow(#RealType) << int(QMetaType::MetaTypeName) << getSize; 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::isRelocatable) \ - << bool(QTypeInfoQuery::isComplex) \ + << bool(QTypeInfo::isRelocatable) \ + << bool(QTypeInfo::isComplex) \ << bool(QtPrivate::IsPointerToTypeDerivedFromQObject::Value) \ << bool(std::is_enum::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 b871bfcac97..5fa06c4f463 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -3187,7 +3187,7 @@ template void playWithVariant(const T &orig, bool isNull, const QString { QVariant v2 = v; - if (!(QTypeInfo::isStatic && QTypeInfo::isComplex)) { + if (QTypeInfo::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 void playWithVariant(const T &orig, bool isNull, const QString v = QVariant(); QCOMPARE(v3, v); v = v2; - if (!(QTypeInfo::isStatic && QTypeInfo::isComplex)) { + if (QTypeInfo::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 0d467cc364d..308b60d83b1 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::isStatic); + static_assert(QTypeInfo::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 efec562ba96..01729270424 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::isComplex && !QTypeInfo::isStatic); - QVERIFY(QTypeInfo::isComplex && !QTypeInfo::isStatic); - QVERIFY(QTypeInfo::isComplex && QTypeInfo::isStatic); + static_assert(!QTypeInfo::isComplex); + static_assert(QTypeInfo::isRelocatable); + static_assert(QTypeInfo::isComplex); + static_assert(QTypeInfo::isRelocatable); + static_assert(QTypeInfo::isComplex); + static_assert(!QTypeInfo::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 56651ae4749..f37633b64c5 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::isStatic); +static_assert(QTypeInfo::isRelocatable); static_assert(!QTypeInfo::isComplex); -static_assert(!QTypeInfo::isStatic); +static_assert(QTypeInfo::isRelocatable); static_assert(QTypeInfo::isComplex); -static_assert(QTypeInfo::isStatic); +static_assert(!QTypeInfo::isRelocatable); static_assert(QTypeInfo::isComplex); @@ -2144,7 +2144,7 @@ void tst_QList::resizePOD_data() const QTest::addColumn("size"); QVERIFY(!QTypeInfo::isComplex); - QVERIFY(!QTypeInfo::isStatic); + QVERIFY(QTypeInfo::isRelocatable); QList null; QList empty(0, 5); @@ -2192,7 +2192,7 @@ void tst_QList::resizeComplexMovable_data() const QTest::addColumn("size"); QVERIFY(QTypeInfo::isComplex); - QVERIFY(!QTypeInfo::isStatic); + QVERIFY(QTypeInfo::isRelocatable); QList null; QList empty(0, 'Q'); @@ -2244,7 +2244,7 @@ void tst_QList::resizeComplex_data() const QTest::addColumn("size"); QVERIFY(QTypeInfo::isComplex); - QVERIFY(QTypeInfo::isStatic); + QVERIFY(!QTypeInfo::isRelocatable); QList null; QList empty(0, '0'); diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp index 70caa055b66..70808e3e48f 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 QPairPM; typedef QPair QPairPP; static_assert( QTypeInfo::isComplex); -static_assert( QTypeInfo::isStatic ); +static_assert( !QTypeInfo::isRelocatable ); static_assert( QTypeInfo::isComplex); -static_assert( QTypeInfo::isStatic ); +static_assert( !QTypeInfo::isRelocatable ); static_assert( QTypeInfo::isComplex); -static_assert( QTypeInfo::isStatic ); +static_assert( !QTypeInfo::isRelocatable ); static_assert( QTypeInfo::isComplex); -static_assert( QTypeInfo::isStatic ); +static_assert( !QTypeInfo::isRelocatable ); static_assert( QTypeInfo::isComplex); -static_assert(!QTypeInfo::isStatic ); +static_assert( QTypeInfo::isRelocatable ); static_assert( QTypeInfo::isComplex); -static_assert(!QTypeInfo::isStatic ); +static_assert( QTypeInfo::isRelocatable ); static_assert( QTypeInfo::isComplex); -static_assert( QTypeInfo::isStatic ); +static_assert( !QTypeInfo::isRelocatable ); static_assert( QTypeInfo::isComplex); -static_assert(!QTypeInfo::isStatic ); +static_assert( QTypeInfo::isRelocatable ); static_assert(!QTypeInfo::isComplex); -static_assert(!QTypeInfo::isStatic ); +static_assert( QTypeInfo::isRelocatable ); static_assert(!QTypeInfo::isPointer); diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index 3a504177db2..5c5ccf0a21c 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 Container; enum { - isStatic = QTypeInfo::isStatic, + isRelocatable = QTypeInfo::isRelocatable, isComplex = QTypeInfo::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 670b271d545..be34fa76396 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("isComplex"); #define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \ - QTest::newRow(#RealType) << MetaTypeId << bool(QTypeInfoQuery::isRelocatable) << bool(QTypeInfoQuery::isComplex); + QTest::newRow(#RealType) << MetaTypeId << bool(QTypeInfo::isRelocatable) << bool(QTypeInfo::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 ce718b69eab..1f615f6e697 100644 --- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h +++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h @@ -361,7 +361,7 @@ void QRawVector::realloc(int asize, int aalloc, bool ref) T *xbegin = m_begin; if (aalloc != xalloc || ref) { // (re)allocate memory - if (QTypeInfo::isStatic) { + if (!QTypeInfo::isRelocatable) { xbegin = allocate(aalloc); xsize = 0; changed = true; @@ -462,7 +462,7 @@ typename QRawVector::iterator QRawVector::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::isStatic) { + if (!QTypeInfo::isRelocatable) { T *b = m_begin + m_size; T *i = m_begin + m_size + n; while (i != b)