diff options
author | Marco Bubke <marco.bubke@qt.io> | 2017-11-23 14:30:09 +0100 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2018-01-17 12:22:30 +0000 |
commit | e0ea602f6cd3c3289722cd6b22ca2ba02eefc846 (patch) | |
tree | 6040ac23abfb9454cd877fdd653e90b23f000f2a /src/plugins/clangrefactoring/refactoringengine.cpp | |
parent | 7666db896d093e450c18f6a6f12d7fa289fb789b (diff) | |
download | qt-creator-e0ea602f6cd3c3289722cd6b22ca2ba02eefc846.tar.gz |
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>
Diffstat (limited to 'src/plugins/clangrefactoring/refactoringengine.cpp')
-rw-r--r-- | src/plugins/clangrefactoring/refactoringengine.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/clangrefactoring/refactoringengine.cpp b/src/plugins/clangrefactoring/refactoringengine.cpp index 75f79a7a2b..7c69cfc9d1 100644 --- a/src/plugins/clangrefactoring/refactoringengine.cpp +++ b/src/plugins/clangrefactoring/refactoringengine.cpp @@ -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; + CppTools::Usages usages; + QTextCursor cursor = Utils::Text::wordStartCursor(data.cursor()); - Utils::Text::convertPosition(cursor.document(), cursor.position(), &line, &column); + 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); + } - 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); + return usages; } void RefactoringEngine::globalRename(const CppTools::CursorInEditor &data, |