summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-03-21 10:48:05 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-03-22 02:54:15 +0100
commitf4bac3ca173be9f219099c04e76d6d62c4d0e19e (patch)
tree8ba8377414f0a65195cdd74f6d4f0bf2b9e9577c /src/corelib/global
parentb20da0ba2844b1ecbb7b128f3075f7285673b604 (diff)
QTypeInfo: add detection for Clang's __is_trivially_relocatable
Types marked with [[clang::trivial_abi]] are considered to be trivially relocatable for Clang. This is ABI compatible, since in Qt 6 we can change the value of QTypeInfo::IsRelocatable "after the fact" -- it simply means that code that doesn't get recompiled is pessimized. Change-Id: I32e52bfb212c7919b2ebcf7832ede4404358330f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qtypeinfo.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h
index 9b2119da1d..473854f230 100644
--- a/src/corelib/global/qtypeinfo.h
+++ b/src/corelib/global/qtypeinfo.h
@@ -23,7 +23,13 @@ class QDebug;
namespace QtPrivate {
template <typename T>
-inline constexpr bool qIsRelocatable = std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<T>;
+inline constexpr bool qIsRelocatable = (std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<T>)
+#if defined(__has_builtin)
+#if __has_builtin(__is_trivially_relocatable)
+ || __is_trivially_relocatable(T)
+#endif
+#endif
+ ;
// Denotes types that are trivially default constructible, and for which
// value-initialization can be achieved by filling their storage with 0 bits.