diff options
author | Tim Blechmann <tim@klingt.org> | 2021-04-25 10:47:19 +0800 |
---|---|---|
committer | Tim Blechmann <tim@klingt.org> | 2021-04-27 10:56:52 +0000 |
commit | f4a64fd8c8492effc27a4609f1f5bccdba742a92 (patch) | |
tree | 86a8357e282c612965234a6bf5860f8d85d3457a /src/libs/cplusplus/pp-engine.cpp | |
parent | c4c3d4cc3349a387d6ef85f856ebdd5b283bd668 (diff) | |
download | qt-creator-f4a64fd8c8492effc27a4609f1f5bccdba742a92.tar.gz |
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>
Diffstat (limited to 'src/libs/cplusplus/pp-engine.cpp')
-rw-r--r-- | src/libs/cplusplus/pp-engine.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 913a6a3c9b..b3cfe6bd15 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1219,12 +1219,12 @@ bool Preprocessor::handleFunctionLikeMacro(const Macro *macro, // No formal macro parameter for this identifier in the body. bodyTk.f.generated = true; bodyTk.lineno = baseLine; - expanded.push_back(bodyTk); + expanded.push_back(std::move(bodyTk)); } } else if (bodyTk.isNot(T_POUND) && bodyTk.isNot(T_POUND_POUND)) { bodyTk.f.generated = true; bodyTk.lineno = baseLine; - expanded.push_back(bodyTk); + expanded.push_back(std::move(bodyTk)); } if (i > 1 && body[int(i) - 1].is(T_POUND_POUND)) { |