From d2e15e5f1efa1ef160a2d4f40ab61180477d1f14 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 21 Sep 2017 11:43:59 +0200 Subject: Clang: Add file cache The database is using file path integer ids to handle file paths because otherwise we would save many redundant data. This patch is improving it further with the introduction of a database based file path cache. The entries are now divided in a directory path and file name. This is quite handy for directory based file watching. Change-Id: I03f2e388e43f3d521d6bf8e39dfb95eb2309dc73 Reviewed-by: Tim Jenssen --- src/plugins/clangrefactoring/refactoringengine.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/plugins/clangrefactoring/refactoringengine.cpp') diff --git a/src/plugins/clangrefactoring/refactoringengine.cpp b/src/plugins/clangrefactoring/refactoringengine.cpp index 696e38c468..bc9ec9ab68 100644 --- a/src/plugins/clangrefactoring/refactoringengine.cpp +++ b/src/plugins/clangrefactoring/refactoringengine.cpp @@ -46,9 +46,11 @@ namespace ClangRefactoring { using ClangBackEnd::RequestSourceLocationsForRenamingMessage; RefactoringEngine::RefactoringEngine(ClangBackEnd::RefactoringServerInterface &server, - ClangBackEnd::RefactoringClientInterface &client) - : server(server), - client(client) + ClangBackEnd::RefactoringClientInterface &client, + ClangBackEnd::FilePathCachingInterface &filePathCache) + : m_server(server), + m_client(client), + m_filePathCache(filePathCache) { } @@ -60,7 +62,7 @@ void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data, setUsable(false); - client.setLocalRenamingCallback(std::move(renameSymbolsCallback)); + m_client.setLocalRenamingCallback(std::move(renameSymbolsCallback)); QString filePath = data.filePath().toString(); QTextCursor textCursor = data.cursor(); @@ -79,7 +81,7 @@ void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data, textCursor.document()->revision()); - server.requestSourceLocationsForRenamingMessage(std::move(message)); + m_server.requestSourceLocationsForRenamingMessage(std::move(message)); } void RefactoringEngine::startGlobalRenaming(const CppTools::CursorInEditor &) @@ -89,12 +91,12 @@ void RefactoringEngine::startGlobalRenaming(const CppTools::CursorInEditor &) bool RefactoringEngine::isUsable() const { - return server.isUsable(); + return m_server.isUsable(); } void RefactoringEngine::setUsable(bool isUsable) { - server.setUsable(isUsable); + m_server.setUsable(isUsable); } } // namespace ClangRefactoring -- cgit v1.2.1