diff options
-rw-r--r-- | src/libs/3rdparty/cplusplus/Symbol.cpp | 4 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/TranslationUnit.cpp | 38 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/TranslationUnit.h | 2 | ||||
-rw-r--r-- | src/libs/cplusplus/FindUsages.cpp | 4 | ||||
-rw-r--r-- | src/libs/cplusplus/SimpleLexer.cpp | 2 | ||||
-rw-r--r-- | src/libs/cplusplus/pp-engine.cpp | 14 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppcodemodelinspectordialog.cpp | 4 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppeditor.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cppeditor/fileandtokenactions_test.cpp | 4 |
9 files changed, 37 insertions, 37 deletions
diff --git a/src/libs/3rdparty/cplusplus/Symbol.cpp b/src/libs/3rdparty/cplusplus/Symbol.cpp index cb55c559b0..f3a86e6a8b 100644 --- a/src/libs/3rdparty/cplusplus/Symbol.cpp +++ b/src/libs/3rdparty/cplusplus/Symbol.cpp @@ -165,8 +165,8 @@ void Symbol::setSourceLocation(unsigned sourceLocation, TranslationUnit *transla if (translationUnit) { const Token &tk = translationUnit->tokenAt(sourceLocation); - _isGenerated = tk.f.generated; - translationUnit->getPosition(tk.offset, &_line, &_column, &_fileId); + _isGenerated = tk.generated(); + translationUnit->getPosition(tk.begin(), &_line, &_column, &_fileId); } else { _isGenerated = false; _line = 0; diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp index f37ef6a242..226e25e44e 100644 --- a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp +++ b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp @@ -164,14 +164,14 @@ void TranslationUnit::tokenize() _Lrecognize: if (tk.is(T_POUND) && tk.newline()) { - unsigned offset = tk.offset; + unsigned offset = tk.begin(); lex(&tk); - if (! tk.f.newline && tk.is(T_IDENTIFIER) && tk.identifier == expansionId) { + if (! tk.newline() && tk.is(T_IDENTIFIER) && tk.identifier == expansionId) { // It's an expansion mark. lex(&tk); - if (!tk.f.newline && tk.is(T_IDENTIFIER)) { + if (!tk.newline() && tk.is(T_IDENTIFIER)) { if (tk.identifier == beginId) { // Start of a macro expansion section. lex(&tk); @@ -191,7 +191,7 @@ void TranslationUnit::tokenize() // Now we need to gather the real line and columns from the upcoming // tokens. But notice this is only relevant for tokens which are expanded // but not generated. - while (tk.isNot(T_EOF_SYMBOL) && !tk.f.newline) { + while (tk.isNot(T_EOF_SYMBOL) && !tk.newline()) { // When we get a ~ it means there's a number of generated tokens // following. Otherwise, we have actual data. if (tk.is(T_TILDE)) { @@ -229,25 +229,25 @@ void TranslationUnit::tokenize() } } } else { - if (! tk.f.newline && tk.is(T_IDENTIFIER) && tk.identifier == lineId) + if (! tk.newline() && tk.is(T_IDENTIFIER) && tk.identifier == lineId) lex(&tk); - if (! tk.f.newline && tk.is(T_NUMERIC_LITERAL)) { + if (! tk.newline() && tk.is(T_NUMERIC_LITERAL)) { unsigned line = (unsigned) strtoul(tk.spell(), 0, 0); lex(&tk); - if (! tk.f.newline && tk.is(T_STRING_LITERAL)) { + if (! tk.newline() && tk.is(T_STRING_LITERAL)) { const StringLiteral *fileName = control()->stringLiteral(tk.string->chars(), tk.string->size()); pushPreprocessorLine(offset, line, fileName); lex(&tk); } } - while (tk.isNot(T_EOF_SYMBOL) && ! tk.f.newline) + while (tk.isNot(T_EOF_SYMBOL) && ! tk.newline()) lex(&tk); } goto _Lrecognize; - } else if (tk.f.kind == T_LBRACE) { + } else if (tk.kind() == T_LBRACE) { braces.push(unsigned(_tokens->size())); - } else if (tk.f.kind == T_RBRACE && ! braces.empty()) { + } else if (tk.kind() == T_RBRACE && ! braces.empty()) { const unsigned open_brace_index = braces.top(); braces.pop(); if (open_brace_index < tokenCount()) @@ -264,7 +264,7 @@ void TranslationUnit::tokenize() currentExpanded = true; const std::pair<unsigned, unsigned> &p = lineColumn[lineColumnIdx]; if (p.first) - _expandedLineColumn.insert(std::make_pair(tk.offset, p)); + _expandedLineColumn.insert(std::make_pair(tk.begin(), p)); else currentGenerated = true; @@ -275,7 +275,7 @@ void TranslationUnit::tokenize() tk.f.generated = currentGenerated; _tokens->push_back(tk); - } while (tk.f.kind); + } while (tk.kind()); for (; ! braces.empty(); braces.pop()) { unsigned open_brace_index = braces.top(); @@ -382,7 +382,7 @@ void TranslationUnit::getTokenPosition(unsigned index, unsigned *line, unsigned *column, const StringLiteral **fileName) const -{ return getPosition(tokenAt(index).offset, line, column, fileName); } +{ return getPosition(tokenAt(index).begin(), line, column, fileName); } void TranslationUnit::getTokenStartPosition(unsigned index, unsigned *line, unsigned *column, @@ -508,7 +508,7 @@ void TranslationUnit::fatal(unsigned index, const char *format, ...) unsigned TranslationUnit::findPreviousLineOffset(unsigned tokenIndex) const { - unsigned lineOffset = _lineOffsets[findLineNumber(tokenAt(tokenIndex).offset)]; + unsigned lineOffset = _lineOffsets[findLineNumber(tokenAt(tokenIndex).begin())]; return lineOffset; } @@ -525,17 +525,17 @@ bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex) Token newGreater; newGreater.f.kind = T_GREATER; - newGreater.f.expanded = tok.f.expanded; - newGreater.f.generated = tok.f.generated; + newGreater.f.expanded = tok.expanded(); + newGreater.f.generated = tok.generated(); newGreater.f.length = 1; newGreater.offset = tok.offset + 1; _tokens->insert(_tokens->begin() + tokenIndex + 1, newGreater); - TokenLineColumn::const_iterator it = _expandedLineColumn.find(tok.offset); + TokenLineColumn::const_iterator it = _expandedLineColumn.find(tok.begin()); if (it != _expandedLineColumn.end()) { const std::pair<unsigned, unsigned> newPosition(it->second.first, it->second.second + 1); - _expandedLineColumn.insert(std::make_pair(newGreater.offset, newPosition)); + _expandedLineColumn.insert(std::make_pair(newGreater.begin(), newPosition)); } return true; @@ -551,7 +551,7 @@ void TranslationUnit::releaseTokensAndComments() void TranslationUnit::showErrorLine(unsigned index, unsigned column, FILE *out) { - unsigned lineOffset = _lineOffsets[findLineNumber(tokenAt(index).offset)]; + unsigned lineOffset = _lineOffsets[findLineNumber(tokenAt(index).begin())]; for (const char *cp = _firstSourceChar + lineOffset + 1; *cp && *cp != '\n'; ++cp) { fputc(*cp, out); } diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.h b/src/libs/3rdparty/cplusplus/TranslationUnit.h index d5682cd1b3..d1c89f5746 100644 --- a/src/libs/3rdparty/cplusplus/TranslationUnit.h +++ b/src/libs/3rdparty/cplusplus/TranslationUnit.h @@ -67,7 +67,7 @@ public: const Token &tokenAt(unsigned index) const { return _tokens && index < tokenCount() ? (*_tokens)[index] : nullToken; } - int tokenKind(unsigned index) const { return tokenAt(index).f.kind; } + int tokenKind(unsigned index) const { return tokenAt(index).kind(); } const char *spell(unsigned index) const; unsigned commentCount() const; diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index 14921e54d8..383bd3dad7 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -140,7 +140,7 @@ void FindUsages::reportResult(unsigned tokenIndex, const QList<LookupItem> &cand QString FindUsages::matchingLine(const Token &tk) const { const char *beg = _source.constData(); - const char *cp = beg + tk.offset; + const char *cp = beg + tk.begin(); for (; cp != beg - 1; --cp) { if (*cp == '\n') break; @@ -178,7 +178,7 @@ void FindUsages::reportResult(unsigned tokenIndex) if (col) --col; // adjust the column position. - const int len = tk.f.length; + const int len = tk.length(); const Usage u(_doc->fileName(), lineText, line, col, len); _usages.append(u); diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp index 578c09ac9e..6ab2f4db91 100644 --- a/src/libs/cplusplus/SimpleLexer.cpp +++ b/src/libs/cplusplus/SimpleLexer.cpp @@ -92,7 +92,7 @@ QList<Token> SimpleLexer::operator()(const QString &text, int state) QStringRef spell = text.midRef(tk.begin(), tk.length()); lex.setScanAngleStringLiteralTokens(false); - if (tk.f.newline && tk.is(T_POUND)) + if (tk.newline() && tk.is(T_POUND)) inPreproc = true; else if (inPreproc && tokens.size() == 1 && tk.is(T_IDENTIFIER) && spell == QLatin1String("include")) diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 62100ce717..942f3e5315 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1026,7 +1026,7 @@ bool Preprocessor::handleIdentifier(PPToken *tk) //### TODO: error message pushToken(tk); // If a previous marker was found, make sure to put it back. - if (oldMarkerTk.f.length) + if (oldMarkerTk.length()) pushToken(&oldMarkerTk); *tk = idTk; return false; @@ -1072,7 +1072,7 @@ bool Preprocessor::handleIdentifier(PPToken *tk) // This is not the most beautiful approach but it's quite reasonable. What we do here // is to create a fake identifier token which is only composed by whitespaces. It's // also not marked as expanded so it it can be treated as a regular token. - const QByteArray content(int(idTk.f.length + computeDistance(idTk)), ' '); + const QByteArray content(int(idTk.length() + computeDistance(idTk)), ' '); PPToken fakeIdentifier = generateToken(T_IDENTIFIER, content.constData(), content.length(), idTk.lineno, false, false); @@ -1085,8 +1085,8 @@ bool Preprocessor::handleIdentifier(PPToken *tk) // The first body token replaces the macro invocation so its whitespace and // newline info is replicated. PPToken &bodyTk = body[0]; - bodyTk.f.whitespace = idTk.f.whitespace; - bodyTk.f.newline = idTk.f.newline; + bodyTk.f.whitespace = idTk.whitespace(); + bodyTk.f.newline = idTk.newline(); // Expansions are tracked from a "top-level" basis. This means that each expansion // section in the output corresponds to a direct use of a macro (either object-like @@ -1105,13 +1105,13 @@ bool Preprocessor::handleIdentifier(PPToken *tk) || m_state.m_expansionStatus == JustFinishedExpansion) { PPToken marker; marker.f.expanded = true; - marker.f.length = idTk.f.length; + marker.f.length = idTk.length(); marker.offset = idTk.offset; marker.lineno = idTk.lineno; body.prepend(marker); body.append(marker); m_state.setExpansionStatus(ReadyForExpansion); - } else if (oldMarkerTk.f.length + } else if (oldMarkerTk.length() && (m_state.m_expansionStatus == ReadyForExpansion || m_state.m_expansionStatus == Expanding)) { body.append(oldMarkerTk); @@ -2023,7 +2023,7 @@ PPToken Preprocessor::generateConcatenated(const PPToken &leftTk, const PPToken newText.append(leftTk.tokenStart(), leftTk.length()); newText.append(rightTk.tokenStart(), rightTk.length()); PPToken result = generateToken(T_IDENTIFIER, newText.constData(), newText.size(), leftTk.lineno, true); - result.f.whitespace = leftTk.f.whitespace; + result.f.whitespace = leftTk.whitespace(); return result; } diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp index 50e9425989..184d6e9de3 100644 --- a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp +++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp @@ -852,7 +852,7 @@ void TokensModel::configure(CPlusPlus::TranslationUnit *translationUnit) for (int i = 0, total = translationUnit->tokenCount(); i < total; ++i) { TokenInfo info; info.token = translationUnit->tokenAt(i); - translationUnit->getPosition(info.token.offset, &info.line, &info.column); + translationUnit->getPosition(info.token.begin(), &info.line, &info.column); m_tokenInfos.append(info); } emit layoutChanged(); @@ -888,7 +888,7 @@ QVariant TokensModel::data(const QModelIndex &index, int role) const else if (column == IndexColumn) return index.row(); else if (column == OffsetColumn) - return token.offset; + return token.begin(); else if (column == LineColumnNumberColumn) return QString::fromLatin1("%1:%2") .arg(CMI::Utils::toString(info.line), CMI::Utils::toString(info.column)); diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 98888ef4df..3a7bc93cd0 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -794,7 +794,7 @@ void CPPEditorWidget::markSymbolsNow() if (column) --column; // adjust the column position. - const int len = unit->tokenAt(index).f.length; + const int len = unit->tokenAt(index).length(); QTextCursor cursor(document()->findBlockByNumber(line - 1)); cursor.setPosition(cursor.position() + column); diff --git a/src/plugins/cppeditor/fileandtokenactions_test.cpp b/src/plugins/cppeditor/fileandtokenactions_test.cpp index 2cc10c1359..9483e92166 100644 --- a/src/plugins/cppeditor/fileandtokenactions_test.cpp +++ b/src/plugins/cppeditor/fileandtokenactions_test.cpp @@ -238,7 +238,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti } else { // Position the cursor on the token unsigned line, column; - translationUnit->getPosition(token.offset, &line, &column); + translationUnit->getPosition(token.begin(), &line, &column); editor->gotoLine(line, column - 1); QApplication::processEvents(); @@ -291,7 +291,7 @@ void TestActionsTestCase::moveWordCamelCaseToToken(TranslationUnit *translationU QVERIFY(editorWidget); unsigned line, column; - translationUnit->getPosition(token.offset, &line, &column); + translationUnit->getPosition(token.begin(), &line, &column); while (editor->currentLine() < (int) line || (editor->currentLine() == (int) line |