Clang: implement findUsages with existing index

Functionality is limited to the abilities of
current index which is not updated and is
generated only at project open.
Search box temporarily doesn't allow to "Search again".

Change-Id: Id1047f27ad0aafc901f06aa51ad38ceab95eaebb
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2017-09-19 15:38:20 +02:00
parent 263cdc0397
commit 050b4dd2f5
19 changed files with 289 additions and 44 deletions

View File

@@ -25,7 +25,9 @@
#pragma once
#include <filepathcachingfwd.h>
#include "symbolqueryinterface.h"
#include <clangsupport/filepathcachingfwd.h>
#include <cpptools/refactoringengineinterface.h>
@@ -41,25 +43,33 @@ class RefactoringEngine : public CppTools::RefactoringEngineInterface
public:
RefactoringEngine(ClangBackEnd::RefactoringServerInterface &m_server,
ClangBackEnd::RefactoringClientInterface &m_client,
ClangBackEnd::FilePathCachingInterface &filePathCache);
ClangBackEnd::FilePathCachingInterface &filePathCache,
SymbolQueryInterface &symbolQuery);
~RefactoringEngine() override;
void startLocalRenaming(const CppTools::CursorInEditor &data,
CppTools::ProjectPart *projectPart,
RenameCallback &&renameSymbolsCallback) override;
void startGlobalRenaming(const CppTools::CursorInEditor &data) override;
void findUsages(const CppTools::CursorInEditor &data,
CppTools::UsagesCallback &&showUsagesCallback) const override;
bool isRefactoringEngineAvailable() const override;
void setRefactoringEngineAvailable(bool isAvailable);
ClangBackEnd::FilePathCachingInterface &filePathCache()
const ClangBackEnd::FilePathCachingInterface &filePathCache() const
{
return m_filePathCache;
}
private:
CppTools::Usages locationsAt(const CppTools::CursorInEditor &data) const;
ClangBackEnd::RefactoringServerInterface &m_server;
ClangBackEnd::RefactoringClientInterface &m_client;
ClangBackEnd::FilePathCachingInterface &m_filePathCache;
SymbolQueryInterface &m_symbolQuery;
};
} // namespace ClangRefactoring