cplusplus: PPToken - introduce move constructor

profiling qt-creator on my codebase i saw quite a few instances where
reference counting of `QByteArray` showed up in
`Preprocessor::handleFunctionLikeMacro` (hundreds of milliseconds of CPU
time when profiling for a few seconds). using move semantics we can
avoid this source of reference counting.

Change-Id: I19a88a0501064f53d8095f7377bf901e462d25a0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Tim Blechmann
2021-04-25 10:47:19 +08:00
parent c4c3d4cc33
commit f4a64fd8c8
2 changed files with 6 additions and 2 deletions

View File

@@ -109,6 +109,10 @@ public:
: m_src(src)
{}
PPToken(QByteArray &&src)
: m_src(std::move(src))
{}
void setSource(const QByteArray &src)
{ m_src = src; }