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 SourceLocationContainer &end = sourceRange.end;
const unsigned length = end.column - start.column; const unsigned length = end.column - start.column;
return CppTools::CursorInfo::Range(start.line, start.column, length); return {start.line, start.column, length};
} }
static static

View File

@@ -39,6 +39,7 @@ class ClangCompletionAssistInterface;
class ClangCompletionContextAnalyzer class ClangCompletionContextAnalyzer
{ {
public: public:
ClangCompletionContextAnalyzer() = delete;
ClangCompletionContextAnalyzer(const ClangCompletionAssistInterface *assistInterface, ClangCompletionContextAnalyzer(const ClangCompletionAssistInterface *assistInterface,
CPlusPlus::LanguageFeatures languageFeatures); CPlusPlus::LanguageFeatures languageFeatures);
void analyze(); void analyze();
@@ -61,8 +62,6 @@ public:
bool addSnippets() const { return m_addSnippets; } bool addSnippets() const { return m_addSnippets; }
private: private:
ClangCompletionContextAnalyzer();
int startOfFunctionCall(int endOfExpression) const; int startOfFunctionCall(int endOfExpression) const;
void setActionAndClangPosition(CompletionAction action, void setActionAndClangPosition(CompletionAction action,

View File

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

View File

@@ -209,12 +209,12 @@ TextEditor::BlockRange
toTextEditorBlock(QTextDocument *textDocument, toTextEditorBlock(QTextDocument *textDocument,
const ClangBackEnd::SourceRangeContainer &sourceRangeContainer) const ClangBackEnd::SourceRangeContainer &sourceRangeContainer)
{ {
return TextEditor::BlockRange(::Utils::Text::positionInText(textDocument, return {::Utils::Text::positionInText(textDocument,
sourceRangeContainer.start.line, sourceRangeContainer.start.line,
sourceRangeContainer.start.column), sourceRangeContainer.start.column),
::Utils::Text::positionInText(textDocument, ::Utils::Text::positionInText(textDocument,
sourceRangeContainer.end.line, sourceRangeContainer.end.line,
sourceRangeContainer.end.column)); sourceRangeContainer.end.column)};
} }
QList<TextEditor::BlockRange> QList<TextEditor::BlockRange>

View File

@@ -35,6 +35,8 @@
#include <utils/textutils.h> #include <utils/textutils.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <memory>
namespace ClangCodeModel { namespace ClangCodeModel {
namespace Internal { namespace Internal {
@@ -199,7 +201,7 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
if (m_watcher) if (m_watcher)
m_watcher->cancel(); m_watcher->cancel();
m_watcher.reset(new FutureSymbolWatcher()); m_watcher = std::make_unique<FutureSymbolWatcher>();
QObject::connect(m_watcher.get(), &FutureSymbolWatcher::finished, [=, filePath=data.filePath(), QObject::connect(m_watcher.get(), &FutureSymbolWatcher::finished, [=, filePath=data.filePath(),
callback=std::move(processLinkCallback)]() mutable { callback=std::move(processLinkCallback)]() mutable {

View File

@@ -138,10 +138,7 @@ TextEditor::HighlightingResult toHighlightingResult(
{ {
const auto textStyles = toTextStyles(tokenInfo.types); const auto textStyles = toTextStyles(tokenInfo.types);
return TextEditor::HighlightingResult(tokenInfo.line, return {tokenInfo.line, tokenInfo.column, tokenInfo.length, textStyles};
tokenInfo.column,
tokenInfo.length,
textStyles);
} }
} // anonymous } // anonymous

View File

@@ -233,8 +233,8 @@ bool OverviewModel::isGenerated(const QModelIndex &) const
auto item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex)); auto item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex));
if (!item) if (!item)
return {}; return {};
return ::Utils::LineColumn(static_cast<int>(item->token.line), return {static_cast<int>(item->token.line),
static_cast<int>(item->token.column)); static_cast<int>(item->token.column)};
} }
OverviewModel::Range OverviewModel::rangeFromIndex(const QModelIndex &sourceIndex) const OverviewModel::Range OverviewModel::rangeFromIndex(const QModelIndex &sourceIndex) const