Clang: Use LineColumn instead of explicit integers for line and column

With OptionalLineColumn we don't need any bool return parameter any more.

Change-Id: I6f57f221c1bfdf08a92a87a7d71ea0eecf83dbcf
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Marco Bubke
2017-11-23 14:30:09 +01:00
parent 7666db896d
commit e0ea602f6c
4 changed files with 36 additions and 11 deletions

View File

@@ -94,13 +94,20 @@ void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data,
CppTools::Usages RefactoringEngine::locationsAt(const CppTools::CursorInEditor &data) const
{
int line = 0, column = 0;
QTextCursor cursor = Utils::Text::wordStartCursor(data.cursor());
Utils::Text::convertPosition(cursor.document(), cursor.position(), &line, &column);
CppTools::Usages usages;
const QByteArray filePath = data.filePath().toString().toUtf8();
const ClangBackEnd::FilePathId filePathId = m_filePathCache.filePathId(ClangBackEnd::FilePathView(filePath));
return m_symbolQuery.sourceUsagesAt(filePathId, line, column + 1);
QTextCursor cursor = Utils::Text::wordStartCursor(data.cursor());
Utils::OptionalLineColumn lineColumn = Utils::Text::convertPosition(cursor.document(),
cursor.position());
if (lineColumn) {
const QByteArray filePath = data.filePath().toString().toUtf8();
const ClangBackEnd::FilePathId filePathId = m_filePathCache.filePathId(ClangBackEnd::FilePathView(filePath));
usages = m_symbolQuery.sourceUsagesAt(filePathId, lineColumn->line, lineColumn->column + 1);
}
return usages;
}
void RefactoringEngine::globalRename(const CppTools::CursorInEditor &data,