diff options
author | Volker Hilsheimer <[email protected]> | 2024-12-03 13:18:20 +0100 |
---|---|---|
committer | Volker Hilsheimer <[email protected]> | 2024-12-04 23:57:08 +0100 |
commit | e1217cc52bd367b7e040edeb86700dc923df39a8 (patch) | |
tree | 3684c467462007faaaf260a61029482c3a2e6c64 | |
parent | c2b94a15c14f9278dfb28103957f1090f4c323b6 (diff) |
Fix build of lexgen tool
Use QMultiHash explicitly, and build list of values in a QSet via the
range constructor.
Task-number: QTBUG-131842
Pick-to: 6.8
Change-Id: I9cbcddeada0bfd88b11515262f5476e5d59e0fad
Reviewed-by: Thiago Macieira <[email protected]>
Reviewed-by: Edward Welbourne <[email protected]>
-rw-r--r-- | util/lexgen/generator.cpp | 2 | ||||
-rw-r--r-- | util/lexgen/generator.h | 4 | ||||
-rw-r--r-- | util/lexgen/nfa.cpp | 15 | ||||
-rw-r--r-- | util/lexgen/nfa.h | 2 |
4 files changed, 12 insertions, 11 deletions
diff --git a/util/lexgen/generator.cpp b/util/lexgen/generator.cpp index 01de30d5c53..991091d9500 100644 --- a/util/lexgen/generator.cpp +++ b/util/lexgen/generator.cpp @@ -157,7 +157,7 @@ QString Class::definition() const Generator::Generator(const DFA &_dfa, const Config &config) : dfa(_dfa), cfg(config) { - QList<InputType> lst = cfg.maxInputSet.toList(); + QList<InputType> lst(cfg.maxInputSet.cbegin(), cfg.maxInputSet.cend()); std::sort(lst.begin(), lst.end()); minInput = lst.first(); maxInput = lst.last(); diff --git a/util/lexgen/generator.h b/util/lexgen/generator.h index 4ee6fe9811d..70d63338b29 100644 --- a/util/lexgen/generator.h +++ b/util/lexgen/generator.h @@ -40,7 +40,7 @@ public: ~LineStream() { if (!--shared->ref) { - (*shared->stream) << endl; + (*shared->stream) << Qt::endl; delete shared; } } @@ -64,7 +64,7 @@ public: LineStream operator<<(const T &value) { stream << indentStr; stream << value; return LineStream(&stream); } - inline void addNewLine() { stream << endl; } + inline void addNewLine() { stream << Qt::endl; } inline QString toString() const { stream.flush(); return output; } diff --git a/util/lexgen/nfa.cpp b/util/lexgen/nfa.cpp index 2564b15df24..6676acbd567 100644 --- a/util/lexgen/nfa.cpp +++ b/util/lexgen/nfa.cpp @@ -32,7 +32,7 @@ void NFA::addTransition(int from, InputType input, int to) assertValidState(from); assertValidState(to); - states[from].transitions.insertMulti(input, to); + states[from].transitions.insert(input, to); } void NFA::copyFrom(const NFA &other, int baseState) @@ -449,12 +449,13 @@ DFA DFA::minimize() const } } while (!done); - QHash<int, int> statesToEliminate; - for (int i = 0; i < count(); ++i) - for (int j = 0; j < i; ++j) - if (!inequivalentStates[i * count() + j]) { - statesToEliminate.insertMulti(i, j); - } + QMultiHash<int, int> statesToEliminate; + for (int i = 0; i < count(); ++i) { + for (int j = 0; j < i; ++j) { + if (!inequivalentStates[i * count() + j]) + statesToEliminate.insert(i, j); + } + } /* qDebug() << "states to eliminiate:" << statesToEliminate.count(); diff --git a/util/lexgen/nfa.h b/util/lexgen/nfa.h index f806670b07a..70f1f1e34d0 100644 --- a/util/lexgen/nfa.h +++ b/util/lexgen/nfa.h @@ -14,7 +14,7 @@ #include "global.h" -typedef QHash<InputType, int> TransitionMap; +typedef QMultiHash<InputType, int> TransitionMap; struct State { |