Clang: implement globalRename based on clang Index

Has the same limitations as findUsages.

Change-Id: I8de4df2ecbfd8a4f3073666994398dc43af0d73c
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Ivan Donchevskii
2017-09-25 10:51:39 +02:00
parent 3bea291427
commit 81f5c1c8ec
11 changed files with 62 additions and 48 deletions

View File

@@ -90,11 +90,6 @@ void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data,
m_server.requestSourceLocationsForRenamingMessage(std::move(message));
}
void RefactoringEngine::startGlobalRenaming(const CppTools::CursorInEditor &)
{
// TODO: implement
}
CppTools::Usages RefactoringEngine::locationsAt(const CppTools::CursorInEditor &data) const
{
int line = 0, column = 0;
@@ -114,13 +109,16 @@ CppTools::Usages RefactoringEngine::locationsAt(const CppTools::CursorInEditor &
return result;
}
void RefactoringEngine::globalRename(const CppTools::CursorInEditor &data,
CppTools::UsagesCallback &&renameUsagesCallback,
const QString &)
{
renameUsagesCallback(locationsAt(data));
}
void RefactoringEngine::findUsages(const CppTools::CursorInEditor &data,
CppTools::UsagesCallback &&showUsagesCallback) const
{
int line = 0, column = 0;
QTextCursor cursor = Utils::Text::wordStartCursor(data.cursor());
Utils::Text::convertPosition(cursor.document(), cursor.position(), &line, &column);
showUsagesCallback(locationsAt(data));
}