diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2024-07-18 21:35:54 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2024-07-21 22:22:28 +0200 |
| commit | 5cdd1f594d26e1d4f84b00741be1ab7231458512 (patch) | |
| tree | aee1fbe88581719ad7cfa2a6fad681fa82b62f89 /src/corelib/io/qdebug.cpp | |
| parent | 0cef4ae6870fdd57fd908cdecde3c6c426b7321e (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.cpp | 11 |
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 |
