diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp index 27974da0a8..5b88456ce9 100644 --- a/src/tools/qlalr/lalr.cpp +++ b/src/tools/qlalr/lalr.cpp @@ -362,8 +362,10 @@ void Automaton::closure (StatePointer state) if (_M_grammar->isNonTerminal (*item->dot)) { - foreach (const RulePointer &rule, _M_grammar->rule_map.values (*item->dot)) + const auto range = qAsConst(_M_grammar->rule_map).equal_range(*item->dot); + for (auto it = range.first; it != range.second; ++it) { + const RulePointer &rule = *it; Item ii; ii.rule = rule; ii.dot = rule->rhs.begin (); @@ -701,8 +703,10 @@ void Automaton::buildLookaheads () { for (ItemPointer item = p->closure.begin (); item != p->closure.end (); ++item) { - foreach (const Lookback &lookback, lookbacks.values (item)) + const auto range = qAsConst(lookbacks).equal_range(item); + for (auto it = range.first; it != range.second; ++it) { + const Lookback &lookback = *it; StatePointer q = lookback.state; #ifndef QLALR_NO_DEBUG_LOOKAHEADS 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::iterator Name; +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(QLinkedList::iterator, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE typedef QLinkedList NameList; typedef OrderedSet NameSet; // items typedef QLinkedList ItemList; typedef ItemList::iterator ItemPointer; +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(ItemList::iterator, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE // rules typedef QLinkedList debug_infot; typedef debug_infot::iterator RulePointer; +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(debug_infot::iterator, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE typedef QMultiMap RuleMap; // states typedef QLinkedList StateList; typedef StateList::iterator StatePointer; +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(StateList::iterator, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE // arrows typedef QMap Bundle;