diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-06-16 16:48:27 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-01-26 11:21:37 +0000 |
commit | cf9d112d7a99502b7f68c3bce5fe5e2a6d123917 (patch) | |
tree | 3b3322ee188f000312e1f7d3e296fdd5d1325e5a /src/tools/qlalr/lalr.h | |
parent | 18597b2ae2a757de932dbc8314899d5a1d27304e (diff) |
qlalr: remove uses of inefficient QLists
For QList<QLinkedList<T>::iterator>, mark the iterator Q_PRIMITIVE_TYPE.
This should be done in Qt itself, but would be binary incompatible.
For two other types that are used as values in QMultiMap, replaced
foreach (x, map.values(y))
with
auto range = map.equal_range(y);
for (auto it = range.first; it != ramge.second; ++it)
x = *it;
which doesn't require a temporary QList.
Change-Id: I9ddd15dd9b1d5bb3000833d14ed911451a272328
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/tools/qlalr/lalr.h')
-rw-r--r-- | src/tools/qlalr/lalr.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/qlalr/lalr.h b/src/tools/qlalr/lalr.h index 5f252b1acc..28c889e63f 100644 --- a/src/tools/qlalr/lalr.h +++ b/src/tools/qlalr/lalr.h @@ -134,21 +134,33 @@ public: // names typedef QLinkedList<QString>::iterator Name; +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(QLinkedList<QString>::iterator, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE typedef QLinkedList<Name> NameList; typedef OrderedSet<Name> NameSet; // items typedef QLinkedList<Item> ItemList; typedef ItemList::iterator ItemPointer; +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(ItemList::iterator, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE // rules typedef QLinkedList<Rule> debug_infot; typedef debug_infot::iterator RulePointer; +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(debug_infot::iterator, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE typedef QMultiMap<Name, RulePointer> RuleMap; // states typedef QLinkedList<State> StateList; typedef StateList::iterator StatePointer; +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(StateList::iterator, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE // arrows typedef QMap<Name, StatePointer> Bundle; |