summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdebug.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-07-18 21:35:54 +0200
committerMarc Mutz <marc.mutz@qt.io>2024-07-21 22:22:28 +0200
commit5cdd1f594d26e1d4f84b00741be1ab7231458512 (patch)
treeaee1fbe88581719ad7cfa2a6fad681fa82b62f89 /src/corelib/io/qdebug.cpp
parent0cef4ae6870fdd57fd908cdecde3c6c426b7321e (diff)
QDebug: make toString() SCARY
Extract the non-template-dependent code into an out-of-line function and pass the actual streaming operation as a callback. Saves 4% (174811→167936) in executable size for tst_qdebug and 2.7% (93639→91122) for tst_tostring on Linux GCC 9 AMD64 release builds. Pick-to: 6.8 Change-Id: If232e5b26c66981ffcb614f1bdb7007c71e879bf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
-rw-r--r--src/corelib/io/qdebug.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 70832c3dbcb..600b8b13b80 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -1002,6 +1002,17 @@ QDebug &QDebug::resetFormat()
\include qdebug-toString.qdocinc
*/
+/*! \internal */
+QString QDebug::toStringImpl(StreamTypeErased s, const void *obj)
+{
+ QString result;
+ {
+ QDebug d(&result);
+ s(d.nospace(), obj);
+ }
+ return result;
+}
+
/*!
\fn template <class T> QDebug operator<<(QDebug debug, const QList<T> &list)
\relates QDebug