forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -95,7 +95,7 @@ CppTools::CheckSymbols *createHighlighter(const CPlusPlus::Document::Ptr &doc,
|
||||
SimpleLexer tokenize;
|
||||
tokenize.setLanguageFeatures(features);
|
||||
|
||||
const QList<Token> tokens = tokenize(name);
|
||||
const Tokens tokens = tokenize(name);
|
||||
if (tokens.length() && (tokens.at(0).isKeyword() || tokens.at(0).isObjCAtKeyword()))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1449,7 +1449,7 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
|
||||
*savedPaddingDepth = qMax(0, *savedPaddingDepth);
|
||||
}
|
||||
|
||||
void QtStyleCodeFormatter::adjustIndent(const QList<CPlusPlus::Token> &tokens, int lexerState, int *indentDepth, int *paddingDepth) const
|
||||
void QtStyleCodeFormatter::adjustIndent(const Tokens &tokens, int lexerState, int *indentDepth, int *paddingDepth) const
|
||||
{
|
||||
State topState = state();
|
||||
State previousState = state(1);
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void onEnter(int newState, int *indentDepth, int *savedIndentDepth, int *paddingDepth, int *savedPaddingDepth) const = 0;
|
||||
virtual void adjustIndent(const QList<CPlusPlus::Token> &tokens, int lexerState, int *indentDepth, int *paddingDepth) const = 0;
|
||||
virtual void adjustIndent(const CPlusPlus::Tokens &tokens, int lexerState, int *indentDepth, int *paddingDepth) const = 0;
|
||||
|
||||
class State;
|
||||
class BlockData
|
||||
@@ -251,7 +251,7 @@ private:
|
||||
QStack<State> m_currentState;
|
||||
QStack<State> m_newStates;
|
||||
|
||||
QList<CPlusPlus::Token> m_tokens;
|
||||
CPlusPlus::Tokens m_tokens;
|
||||
QString m_currentLine;
|
||||
CPlusPlus::Token m_currentToken;
|
||||
int m_tokenIndex;
|
||||
@@ -276,7 +276,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void onEnter(int newState, int *indentDepth, int *savedIndentDepth, int *paddingDepth, int *savedPaddingDepth) const;
|
||||
virtual void adjustIndent(const QList<CPlusPlus::Token> &tokens, int lexerState, int *indentDepth, int *paddingDepth) const;
|
||||
virtual void adjustIndent(const CPlusPlus::Tokens &tokens, int lexerState, int *indentDepth, int *paddingDepth) const;
|
||||
|
||||
virtual void saveBlockData(QTextBlock *block, const BlockData &data) const;
|
||||
virtual bool loadBlockData(const QTextBlock &block, BlockData *data) const;
|
||||
|
||||
@@ -387,7 +387,7 @@ int CppFunctionHintModel::activeArgument(const QString &prefix) const
|
||||
int argnr = 0;
|
||||
int parcount = 0;
|
||||
SimpleLexer tokenize;
|
||||
QList<Token> tokens = tokenize(prefix);
|
||||
Tokens tokens = tokenize(prefix);
|
||||
for (int i = 0; i < tokens.count(); ++i) {
|
||||
const Token &tk = tokens.at(i);
|
||||
if (tk.is(T_LPAREN))
|
||||
@@ -686,7 +686,7 @@ bool CppCompletionAssistProcessor::accepts() const
|
||||
tokenize.setLanguageFeatures(features);
|
||||
tokenize.setSkipComments(false);
|
||||
|
||||
const QList<Token> &tokens = tokenize(tc.block().text(), BackwardsScanner::previousBlockState(tc.block()));
|
||||
const Tokens &tokens = tokenize(tc.block().text(), BackwardsScanner::previousBlockState(tc.block()));
|
||||
const int tokenIdx = SimpleLexer::tokenBefore(tokens, qMax(0, tc.positionInBlock() - 1));
|
||||
const Token tk = (tokenIdx == -1) ? Token() : tokens.at(tokenIdx);
|
||||
|
||||
@@ -789,7 +789,7 @@ int CppCompletionAssistProcessor::startOfOperator(int pos,
|
||||
SimpleLexer tokenize;
|
||||
tokenize.setLanguageFeatures(m_languageFeatures);
|
||||
tokenize.setSkipComments(false);
|
||||
const QList<Token> &tokens = tokenize(tc.block().text(), BackwardsScanner::previousBlockState(tc.block()));
|
||||
const Tokens &tokens = tokenize(tc.block().text(), BackwardsScanner::previousBlockState(tc.block()));
|
||||
const int tokenIdx = SimpleLexer::tokenBefore(tokens, qMax(0, tc.positionInBlock() - 1)); // get the token at the left of the cursor
|
||||
const Token tk = (tokenIdx == -1) ? Token() : tokens.at(tokenIdx);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor)
|
||||
QTextBlock block = cursor.block();
|
||||
while (block.isValid()) {
|
||||
const QString &text = block.text();
|
||||
const QList<Token> &tks = lexer(text);
|
||||
const Tokens &tks = lexer(text);
|
||||
foreach (const Token &tk, tks) {
|
||||
if (tk.is(T_SEMICOLON) || tk.is(T_LBRACE)) {
|
||||
// No need to continue beyond this, we might already have something meaningful.
|
||||
|
||||
Reference in New Issue
Block a user