De-inline QDebug destructor

This injected quite some code on every use of qDebug and friends,
while not giving any measurable performance benefits.

Change-Id: I7b51f99130f18f1252da01e313f7b97c43a5480d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Kai Koehne 2014-04-29 12:39:31 +02:00 committed by The Qt Project
parent f2891be008
commit 297be273a3
7 changed files with 26 additions and 13 deletions

View File

@ -12,7 +12,8 @@ OBJS=project.o option.o property.o main.o ioutils.o proitems.o \
gbuild.o cesdkhandler.o
#qt code
QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \
QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o \
qdebug.o qmalloc.o qglobal.o \
qarraydata.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfiledevice.o qfile.o \
qfilesystementry.o qfilesystemengine.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o \
qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o \
@ -43,6 +44,7 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/tools/qstring_compat.cpp \
$(SOURCE_PATH)/src/corelib/io/qfiledevice.cpp \
$(SOURCE_PATH)/src/corelib/io/qtextstream.cpp $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \
$(SOURCE_PATH)/src/corelib/io/qdebug.cpp \
$(SOURCE_PATH)/src/corelib/global/qmalloc.cpp \
$(SOURCE_PATH)/src/corelib/global/qglobal.cpp $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp \
$(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp $(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp\
@ -240,6 +242,9 @@ qsettings_win.o: $(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp
qiodevice.o: $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp
qdebug.o: $(SOURCE_PATH)/src/corelib/io/qdebug.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qdebug.cpp
qmalloc.o: $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp

View File

@ -94,6 +94,7 @@ QTOBJS= \
qglobal.obj \
qhash.obj \
qiodevice.obj \
qdebug.obj \
qlist.obj \
qlinkedlist.obj \
qlocale.obj \

View File

@ -128,6 +128,20 @@ QT_BEGIN_NAMESPACE
Flushes any pending data to be written and destroys the debug stream.
*/
// Has been defined in the header / inlined before Qt 5.4
QDebug::~QDebug()
{
if (!--stream->ref) {
if (stream->space && stream->buffer.endsWith(QLatin1Char(' ')))
stream->buffer.chop(1);
if (stream->message_output) {
qt_message_output(stream->type,
stream->context,
stream->buffer);
}
delete stream;
}
}
/*!
\fn QDebug::swap(QDebug &other)

View File

@ -78,18 +78,7 @@ public:
inline QDebug(QtMsgType t) : stream(new Stream(t)) {}
inline QDebug(const QDebug &o):stream(o.stream) { ++stream->ref; }
inline QDebug &operator=(const QDebug &other);
inline ~QDebug() {
if (!--stream->ref) {
if (stream->space && stream->buffer.endsWith(QLatin1Char(' ')))
stream->buffer.chop(1);
if (stream->message_output) {
qt_message_output(stream->type,
stream->context,
stream->buffer);
}
delete stream;
}
}
~QDebug();
inline void swap(QDebug &other) { qSwap(stream, other.stream); }
inline QDebug &space() { stream->space = true; stream->ts << ' '; return *this; }

View File

@ -49,6 +49,7 @@ OBJECTS = \
qfsfileengine_win.o \
qfsfileengine_iterator.o \
qiodevice.o \
qdebug.o \
qtextstream.o \
qlogging.o \
qtemporaryfile.o \

View File

@ -47,6 +47,7 @@ OBJECTS = \
qfsfileengine_win.obj \
qfsfileengine_iterator.obj \
qiodevice.obj \
qdebug.obj \
qtextstream.obj \
qlogging.obj \
qtemporaryfile.obj \
@ -121,6 +122,7 @@ qfsfileengine.obj: $(CORESRC)\io\qfsfileengine.cpp $(PCH)
qfsfileengine_win.obj: $(CORESRC)\io\qfsfileengine_win.cpp $(PCH)
qfsfileengine_iterator.obj: $(CORESRC)\io\qfsfileengine_iterator.cpp $(PCH)
qiodevice.obj: $(CORESRC)\io\qiodevice.cpp $(PCH)
qdebug.obj: $(CORESRC)\io\qdebug.cpp $(PCH)
qtextstream.obj: $(CORESRC)\io\qtextstream.cpp $(PCH)
qtemporaryfile.obj: $(CORESRC)\io\qtemporaryfile.cpp $(PCH)
qstandardpaths.obj: $(CORESRC)\io\qstandardpaths.cpp $(PCH)

View File

@ -109,6 +109,7 @@ SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \
$$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_win.cpp \
$$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_iterator.cpp \
$$QT_SOURCE_TREE/src/corelib/io/qiodevice.cpp \
$$QT_SOURCE_TREE/src/corelib/io/qdebug.cpp \
$$QT_SOURCE_TREE/src/corelib/io/qtextstream.cpp \
$$QT_SOURCE_TREE/src/corelib/io/qtemporaryfile.cpp \
$$QT_SOURCE_TREE/src/corelib/io/qstandardpaths.cpp \