diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-05-23 15:24:22 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-05-23 15:24:22 +0200 |
commit | a3190387ab37849cd5ded6fcf350afca8cd17246 (patch) | |
tree | 30f04e0865d19c9118d022cc5310ff5789e771a2 /src/linguist | |
parent | 96d7a8089e06436072cfc232383ed45d2dd34430 (diff) |
qmake: replace QLinkedList with std::list
This is in preparation of deprecating QLinkedList.
There is but one substantial change: Instead of copying the linked list,
we move it now, and instead of copying items between these two lists, we
use std::list::splice(), which just relinks nodes. It is a bit surprising
that the comment on the ProValueMapStack suggests references into the
container must remain stable, and then some code changes addresses by
making copies of the elements.
This was probably a bug waiting to manifest itself.
This applies the relevant portions of
qtbase/7cba2acd2cc4b68b5a4de2251ab555adb09bf7e8
Change-Id: Ie3d2ff11a38d82ef22e35402c9755757853c9a7a
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/linguist')
-rw-r--r-- | src/linguist/shared/qmakeevaluator.cpp | 10 | ||||
-rw-r--r-- | src/linguist/shared/qmakeevaluator.h | 7 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/linguist/shared/qmakeevaluator.cpp b/src/linguist/shared/qmakeevaluator.cpp index c7fc70a6d..639114d20 100644 --- a/src/linguist/shared/qmakeevaluator.cpp +++ b/src/linguist/shared/qmakeevaluator.cpp @@ -601,14 +601,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock( case TokBypassNesting: blockLen = getBlockLen(tokPtr); if ((m_cumulative || okey != or_op) && blockLen) { - ProValueMapStack savedValuemapStack = m_valuemapStack; + ProValueMapStack savedValuemapStack = std::move(m_valuemapStack); m_valuemapStack.clear(); - m_valuemapStack.append(savedValuemapStack.takeFirst()); + m_valuemapStack.splice(m_valuemapStack.end(), + savedValuemapStack, savedValuemapStack.begin()); traceMsg("visiting nesting-bypassing block"); ret = visitProBlock(tokPtr); traceMsg("visited nesting-bypassing block"); - savedValuemapStack.prepend(m_valuemapStack.first()); - m_valuemapStack = savedValuemapStack; + savedValuemapStack.splice(savedValuemapStack.begin(), + m_valuemapStack, m_valuemapStack.begin()); + m_valuemapStack = std::move(savedValuemapStack); } else { traceMsg("skipped nesting-bypassing block"); ret = ReturnTrue; diff --git a/src/linguist/shared/qmakeevaluator.h b/src/linguist/shared/qmakeevaluator.h index 6df448c71..201275305 100644 --- a/src/linguist/shared/qmakeevaluator.h +++ b/src/linguist/shared/qmakeevaluator.h @@ -38,7 +38,6 @@ #include "ioutils.h" #include <qlist.h> -#include <qlinkedlist.h> #include <qmap.h> #include <qset.h> #include <qstack.h> @@ -54,6 +53,8 @@ # include <qmutex.h> #endif +#include <list> + QT_BEGIN_NAMESPACE class QMakeGlobals; @@ -94,9 +95,9 @@ public: #endif }; -// We use a QLinkedList based stack instead of a QVector based one (QStack), so that +// We use a list-based stack instead of a vector-based one, so that // the addresses of value maps stay constant. The qmake generators rely on that. -class QMAKE_EXPORT ProValueMapStack : public QLinkedList<ProValueMap> +class QMAKE_EXPORT ProValueMapStack : public std::list<ProValueMap> { public: inline void push(const ProValueMap &t) { push_back(t); } |