ClangCodeModel: Modernize

Change-Id: Ie001a2d8ed9c82ac5fedf8e59bd56d7bbdddf919
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Nikolai Kosjar
2019-02-07 12:44:25 +01:00
parent 1740fcc008
commit f6dcc90a6f
7 changed files with 15 additions and 17 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -91,7 +91,7 @@ QChar selectionEndChar(const QChar startSymbol)
return QLatin1Char('"');
if (startSymbol == '<')
return QLatin1Char('>');
return QChar();
return {};
}
void selectToLocationEnd(QTextCursor &cursor)

View File

@@ -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>

View File

@@ -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 {

View File

@@ -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

View File

@@ -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