diff options
author | hjk <hjk121@nokiamail.com> | 2014-11-06 09:35:29 +0100 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2014-11-06 16:13:58 +0100 |
commit | ca151d07fa6d97039fed95dcabe206fce41f5769 (patch) | |
tree | 77b2e92a9fc01a074d3debdb0300d28337b8cf19 /src/libs/cplusplus/SimpleLexer.cpp | |
parent | cb1d040c327f5c8ed8a188e6227ef0e131a3271b (diff) | |
download | qt-creator-ca151d07fa6d97039fed95dcabe206fce41f5769.tar.gz |
CPlusPlus: Use QVector<Token> instead of QList
Better suited to avoid the indirection (sizeof(Token) > sizeof(void *))
Change-Id: Ia5f42781e720ef6aa8161f8f81ae8ddd8e58c837
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/libs/cplusplus/SimpleLexer.cpp')
-rw-r--r-- | src/libs/cplusplus/SimpleLexer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp index cec749eba0..db76bb4c09 100644 --- a/src/libs/cplusplus/SimpleLexer.cpp +++ b/src/libs/cplusplus/SimpleLexer.cpp @@ -62,9 +62,9 @@ bool SimpleLexer::endedJoined() const return _endedJoined; } -QList<Token> SimpleLexer::operator()(const QString &text, int state) +Tokens SimpleLexer::operator()(const QString &text, int state) { - QList<Token> tokens; + Tokens tokens; const QByteArray bytes = text.toUtf8(); const char *firstChar = bytes.constData(); @@ -113,7 +113,7 @@ QList<Token> SimpleLexer::operator()(const QString &text, int state) return tokens; } -int SimpleLexer::tokenAt(const QList<Token> &tokens, unsigned utf16charsOffset) +int SimpleLexer::tokenAt(const Tokens &tokens, unsigned utf16charsOffset) { for (int index = tokens.size() - 1; index >= 0; --index) { const Token &tk = tokens.at(index); @@ -138,12 +138,12 @@ Token SimpleLexer::tokenAt(const QString &text, features.cxx11Enabled = qtMocRunEnabled; SimpleLexer tokenize; tokenize.setLanguageFeatures(features); - const QList<Token> tokens = tokenize(text, state); + const QVector<Token> tokens = tokenize(text, state); const int tokenIdx = tokenAt(tokens, utf16charsOffset); return (tokenIdx == -1) ? Token() : tokens.at(tokenIdx); } -int SimpleLexer::tokenBefore(const QList<Token> &tokens, unsigned utf16charsOffset) +int SimpleLexer::tokenBefore(const Tokens &tokens, unsigned utf16charsOffset) { for (int index = tokens.size() - 1; index >= 0; --index) { const Token &tk = tokens.at(index); |