forked from qt-creator/qt-creator
ClangCodeModel: Modernize
Change-Id: Ie001a2d8ed9c82ac5fedf8e59bd56d7bbdddf919 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -221,7 +221,7 @@ CppTools::CursorInfo::Range toCursorInfoRange(const SourceRangeContainer &source
|
||||
const SourceLocationContainer &end = sourceRange.end;
|
||||
const unsigned length = end.column - start.column;
|
||||
|
||||
return CppTools::CursorInfo::Range(start.line, start.column, length);
|
||||
return {start.line, start.column, length};
|
||||
}
|
||||
|
||||
static
|
||||
|
@@ -39,6 +39,7 @@ class ClangCompletionAssistInterface;
|
||||
class ClangCompletionContextAnalyzer
|
||||
{
|
||||
public:
|
||||
ClangCompletionContextAnalyzer() = delete;
|
||||
ClangCompletionContextAnalyzer(const ClangCompletionAssistInterface *assistInterface,
|
||||
CPlusPlus::LanguageFeatures languageFeatures);
|
||||
void analyze();
|
||||
@@ -61,8 +62,6 @@ public:
|
||||
bool addSnippets() const { return m_addSnippets; }
|
||||
|
||||
private:
|
||||
ClangCompletionContextAnalyzer();
|
||||
|
||||
int startOfFunctionCall(int endOfExpression) const;
|
||||
|
||||
void setActionAndClangPosition(CompletionAction action,
|
||||
|
@@ -91,7 +91,7 @@ QChar selectionEndChar(const QChar startSymbol)
|
||||
return QLatin1Char('"');
|
||||
if (startSymbol == '<')
|
||||
return QLatin1Char('>');
|
||||
return QChar();
|
||||
return {};
|
||||
}
|
||||
|
||||
void selectToLocationEnd(QTextCursor &cursor)
|
||||
|
@@ -209,12 +209,12 @@ TextEditor::BlockRange
|
||||
toTextEditorBlock(QTextDocument *textDocument,
|
||||
const ClangBackEnd::SourceRangeContainer &sourceRangeContainer)
|
||||
{
|
||||
return TextEditor::BlockRange(::Utils::Text::positionInText(textDocument,
|
||||
sourceRangeContainer.start.line,
|
||||
sourceRangeContainer.start.column),
|
||||
::Utils::Text::positionInText(textDocument,
|
||||
sourceRangeContainer.end.line,
|
||||
sourceRangeContainer.end.column));
|
||||
return {::Utils::Text::positionInText(textDocument,
|
||||
sourceRangeContainer.start.line,
|
||||
sourceRangeContainer.start.column),
|
||||
::Utils::Text::positionInText(textDocument,
|
||||
sourceRangeContainer.end.line,
|
||||
sourceRangeContainer.end.column)};
|
||||
}
|
||||
|
||||
QList<TextEditor::BlockRange>
|
||||
|
@@ -35,6 +35,8 @@
|
||||
#include <utils/textutils.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
@@ -199,7 +201,7 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
|
||||
if (m_watcher)
|
||||
m_watcher->cancel();
|
||||
|
||||
m_watcher.reset(new FutureSymbolWatcher());
|
||||
m_watcher = std::make_unique<FutureSymbolWatcher>();
|
||||
|
||||
QObject::connect(m_watcher.get(), &FutureSymbolWatcher::finished, [=, filePath=data.filePath(),
|
||||
callback=std::move(processLinkCallback)]() mutable {
|
||||
|
@@ -138,10 +138,7 @@ TextEditor::HighlightingResult toHighlightingResult(
|
||||
{
|
||||
const auto textStyles = toTextStyles(tokenInfo.types);
|
||||
|
||||
return TextEditor::HighlightingResult(tokenInfo.line,
|
||||
tokenInfo.column,
|
||||
tokenInfo.length,
|
||||
textStyles);
|
||||
return {tokenInfo.line, tokenInfo.column, tokenInfo.length, textStyles};
|
||||
}
|
||||
|
||||
} // anonymous
|
||||
|
@@ -233,8 +233,8 @@ bool OverviewModel::isGenerated(const QModelIndex &) const
|
||||
auto item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex));
|
||||
if (!item)
|
||||
return {};
|
||||
return ::Utils::LineColumn(static_cast<int>(item->token.line),
|
||||
static_cast<int>(item->token.column));
|
||||
return {static_cast<int>(item->token.line),
|
||||
static_cast<int>(item->token.column)};
|
||||
}
|
||||
|
||||
OverviewModel::Range OverviewModel::rangeFromIndex(const QModelIndex &sourceIndex) const
|
||||
|
Reference in New Issue
Block a user