diff options
Diffstat (limited to 'src/tools/moc/symbols.h')
-rw-r--r-- | src/tools/moc/symbols.h | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/src/tools/moc/symbols.h b/src/tools/moc/symbols.h index 8807aeca98..869f7c793f 100644 --- a/src/tools/moc/symbols.h +++ b/src/tools/moc/symbols.h @@ -7,7 +7,7 @@ #include "token.h" #include <qdebug.h> -#include <qhash.h> +#include <qhashfunctions.h> #include <qlist.h> #include <qstack.h> #include <qstring.h> @@ -15,8 +15,6 @@ QT_BEGIN_NAMESPACE -//#define USE_LEXEM_STORE - struct SubArray { inline SubArray() = default; @@ -39,44 +37,14 @@ struct SubArray } }; -inline size_t qHash(const SubArray &key) +inline size_t qHash(const SubArray &key, size_t seed = 0) { - return qHash(QLatin1StringView(key.array.constData() + key.from, key.len)); + return qHash(QLatin1StringView(key.array.constData() + key.from, key.len), seed); } struct Symbol { - -#ifdef USE_LEXEM_STORE - typedef QHash<SubArray, QHashDummyValue> LexemStore; - static LexemStore lexemStore; - - inline Symbol() : lineNum(-1),token(NOTOKEN){} - inline Symbol(int lineNum, Token token): - lineNum(lineNum), token(token){} - inline Symbol(int lineNum, Token token, const QByteArray &lexem): - lineNum(lineNum), token(token),lex(lexem){} - inline Symbol(int lineNum, Token token, const QByteArray &lexem, int from, int len): - lineNum(lineNum), token(token){ - LexemStore::const_iterator it = lexemStore.constFind(SubArray(lexem, from, len)); - - if (it != lexemStore.constEnd()) { - lex = it.key().array; - } else { - lex = lexem.mid(from, len); - lexemStore.insert(lex, QHashDummyValue()); - } - } - int lineNum; - Token token; - inline QByteArray unquotedLexem() const { return lex.mid(1, lex.length()-2); } - inline QByteArray lexem() const { return lex; } - inline operator QByteArray() const { return lex; } - QByteArray lex; - -#else - inline Symbol() = default; inline Symbol(int lineNum, Token token) : lineNum(lineNum), token(token) { } inline Symbol(int lineNum, Token token, const QByteArray &lexem) @@ -99,8 +67,6 @@ struct Symbol QByteArray lex; qsizetype from = 0; qsizetype len = -1; - -#endif }; Q_DECLARE_TYPEINFO(Symbol, Q_RELOCATABLE_TYPE); @@ -110,7 +76,7 @@ struct SafeSymbols { Symbols symbols; QByteArray expandedMacro; QSet<QByteArray> excludedSymbols; - int index; + qsizetype index; }; Q_DECLARE_TYPEINFO(SafeSymbols, Q_RELOCATABLE_TYPE); |