summaryrefslogtreecommitdiff
path: root/src/plugins/clangpchmanager
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/clangpchmanager')
-rw-r--r--src/plugins/clangpchmanager/clangpchmanager-source.pri6
-rw-r--r--src/plugins/clangpchmanager/clangpchmanagerplugin.cpp4
-rw-r--r--src/plugins/clangpchmanager/pchmanagerclient.cpp19
-rw-r--r--src/plugins/clangpchmanager/pchmanagerclient.h7
-rw-r--r--src/plugins/clangpchmanager/precompiledheaderstorage.h97
-rw-r--r--src/plugins/clangpchmanager/precompiledheaderstorageinterface.h50
-rw-r--r--src/plugins/clangpchmanager/projectupdater.cpp5
7 files changed, 6 insertions, 182 deletions
diff --git a/src/plugins/clangpchmanager/clangpchmanager-source.pri b/src/plugins/clangpchmanager/clangpchmanager-source.pri
index 98010437c0..27e35dc740 100644
--- a/src/plugins/clangpchmanager/clangpchmanager-source.pri
+++ b/src/plugins/clangpchmanager/clangpchmanager-source.pri
@@ -12,10 +12,7 @@ HEADERS += \
$$PWD/pchmanagerconnectionclient.h \
$$PWD/clangpchmanager_global.h \
$$PWD/projectupdater.h \
- $$PWD/pchmanagerprojectupdater.h \
- $$PWD/precompiledheaderstorage.h \
- $$PWD/precompiledheaderstorageinterface.h
-
+ $$PWD/pchmanagerprojectupdater.h
SOURCES += \
$$PWD/pchmanagerclient.cpp \
@@ -23,4 +20,3 @@ SOURCES += \
$$PWD/pchmanagerconnectionclient.cpp \
$$PWD/projectupdater.cpp \
$$PWD/pchmanagerprojectupdater.cpp
-
diff --git a/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp b/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp
index 5817db9034..098faf50b3 100644
--- a/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp
+++ b/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp
@@ -27,7 +27,6 @@
#include "pchmanagerconnectionclient.h"
#include "pchmanagerclient.h"
-#include "precompiledheaderstorage.h"
#include "qtcreatorprojectupdater.h"
#include <filepathcaching.h>
@@ -62,8 +61,7 @@ public:
Sqlite::Database database{Utils::PathString{Core::ICore::userResourcePath() + "/symbol-experimental-v1.db"}, 1000ms};
ClangBackEnd::RefactoringDatabaseInitializer<Sqlite::Database> databaseInitializer{database};
ClangBackEnd::FilePathCaching filePathCache{database};
- PrecompiledHeaderStorage<> preCompiledHeaderStorage{database};
- PchManagerClient pchManagerClient{preCompiledHeaderStorage};
+ PchManagerClient pchManagerClient;
PchManagerConnectionClient connectionClient{&pchManagerClient};
QtCreatorProjectUpdater<PchManagerProjectUpdater> projectUpdate{connectionClient.serverProxy(),
pchManagerClient,
diff --git a/src/plugins/clangpchmanager/pchmanagerclient.cpp b/src/plugins/clangpchmanager/pchmanagerclient.cpp
index e5321865ce..81af53308e 100644
--- a/src/plugins/clangpchmanager/pchmanagerclient.cpp
+++ b/src/plugins/clangpchmanager/pchmanagerclient.cpp
@@ -34,11 +34,6 @@
namespace ClangPchManager {
-PchManagerClient::PchManagerClient(PrecompiledHeaderStorageInterface &precompiledHeaderStorage)
- : m_precompiledHeaderStorage(precompiledHeaderStorage)
-{
-}
-
void PchManagerClient::alive()
{
if (m_connectionClient)
@@ -50,7 +45,6 @@ void PchManagerClient::precompiledHeadersUpdated(ClangBackEnd::PrecompiledHeader
for (ClangBackEnd::ProjectPartPch &projectPartPch : message.takeProjectPartPchs()) {
const QString projectPartId{projectPartPch.projectPartId};
const QString pchPath{projectPartPch.pchPath};
- addPchToDatabase(projectPartPch);
addProjectPartPch(std::move(projectPartPch));
precompiledHeaderUpdated(projectPartId, pchPath, projectPartPch.lastModified);
}
@@ -60,7 +54,6 @@ void PchManagerClient::precompiledHeaderRemoved(const QString &projectPartId)
{
for (auto notifier : m_notifiers) {
Utils::SmallString id(projectPartId);
- removePchFromDatabase(id);
removeProjectPartPch(id);
notifier->precompiledHeaderRemoved(projectPartId);
}
@@ -117,18 +110,6 @@ void PchManagerClient::removeProjectPartPch(Utils::SmallStringView projectPartId
}
}
-void PchManagerClient::addPchToDatabase(const ClangBackEnd::ProjectPartPch &projectPartPch)
-{
- m_precompiledHeaderStorage.insertPrecompiledHeader(projectPartPch.projectPartId,
- projectPartPch.pchPath,
- projectPartPch.lastModified);
-}
-
-void PchManagerClient::removePchFromDatabase(const Utils::SmallStringView &projectPartId)
-{
- m_precompiledHeaderStorage.deletePrecompiledHeader(projectPartId);
-}
-
void PchManagerClient::addProjectPartPch(ClangBackEnd::ProjectPartPch &&projectPartPch)
{
auto found = std::lower_bound(m_projectPartPchs.begin(),
diff --git a/src/plugins/clangpchmanager/pchmanagerclient.h b/src/plugins/clangpchmanager/pchmanagerclient.h
index e9b80ebe51..92c44465f2 100644
--- a/src/plugins/clangpchmanager/pchmanagerclient.h
+++ b/src/plugins/clangpchmanager/pchmanagerclient.h
@@ -26,7 +26,6 @@
#pragma once
#include "clangpchmanager_global.h"
-#include "precompiledheaderstorageinterface.h"
#include <pchmanagerclientinterface.h>
#include <projectpartpchproviderinterface.h>
@@ -43,7 +42,7 @@ class CLANGPCHMANAGER_EXPORT PchManagerClient final : public ClangBackEnd::PchMa
{
friend class PchManagerNotifierInterface;
public:
- PchManagerClient(PrecompiledHeaderStorageInterface &precompiledHeaderStorage);
+ PchManagerClient() = default;
void alive() override;
void precompiledHeadersUpdated(ClangBackEnd::PrecompiledHeadersUpdatedMessage &&message) override;
@@ -71,14 +70,10 @@ unittest_public:
void addProjectPartPch(ClangBackEnd::ProjectPartPch &&projectPartPch);
void removeProjectPartPch(Utils::SmallStringView projectPartId);
- void addPchToDatabase(const ClangBackEnd::ProjectPartPch &projectPartPch);
- void removePchFromDatabase(const Utils::SmallStringView &projectPartId);
-
private:
ClangBackEnd::ProjectPartPchs m_projectPartPchs;
std::vector<PchManagerNotifierInterface*> m_notifiers;
PchManagerConnectionClient *m_connectionClient=nullptr;
- PrecompiledHeaderStorageInterface &m_precompiledHeaderStorage;
};
} // namespace ClangPchManager
diff --git a/src/plugins/clangpchmanager/precompiledheaderstorage.h b/src/plugins/clangpchmanager/precompiledheaderstorage.h
deleted file mode 100644
index 4ad57e980a..0000000000
--- a/src/plugins/clangpchmanager/precompiledheaderstorage.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "precompiledheaderstorageinterface.h"
-
-#include <sqlitetransaction.h>
-#include <sqliteexception.h>
-
-#include <utils/smallstringview.h>
-
-namespace ClangPchManager {
-
-template<typename Database=Sqlite::Database>
-class PrecompiledHeaderStorage final : public PrecompiledHeaderStorageInterface
-{
- using ReadStatement = typename Database::ReadStatement;
- using WriteStatement = typename Database::WriteStatement;
-public:
- PrecompiledHeaderStorage(Database &database)
- : m_transaction(database),
- m_database(database)
- {
- m_transaction.commit();
- }
-
- void insertPrecompiledHeader(Utils::SmallStringView projectPartName,
- Utils::SmallStringView pchPath,
- long long pchBuildTime) override
- {
- try {
- Sqlite::ImmediateTransaction transaction{m_database};
-
- m_insertProjectPartStatement.write(projectPartName);
- m_insertPrecompiledHeaderStatement .write(projectPartName, pchPath, pchBuildTime);
-
- transaction.commit();
- } catch (const Sqlite::StatementIsBusy) {
- insertPrecompiledHeader(projectPartName, pchPath, pchBuildTime);
- }
- }
-
- void deletePrecompiledHeader(Utils::SmallStringView projectPartName) override
- {
- try {
- Sqlite::ImmediateTransaction transaction{m_database};
-
- m_deletePrecompiledHeaderStatement.write(projectPartName);
-
- transaction.commit();
- } catch (const Sqlite::StatementIsBusy) {
- deletePrecompiledHeader(projectPartName);
- }
- }
-
-
-public:
- Sqlite::ImmediateNonThrowingDestructorTransaction m_transaction;
- Database &m_database;
- WriteStatement m_insertPrecompiledHeaderStatement {
- "INSERT OR REPLACE INTO precompiledHeaders(projectPartId, pchPath, pchBuildTime) VALUES((SELECT projectPartId FROM projectParts WHERE projectPartName = ?),?,?)",
- m_database
- };
- WriteStatement m_insertProjectPartStatement{
- "INSERT OR IGNORE INTO projectParts(projectPartName) VALUES (?)",
- m_database
- };
- WriteStatement m_deletePrecompiledHeaderStatement{
- "DELETE FROM precompiledHeaders WHERE projectPartId = (SELECT projectPartId FROM projectParts WHERE projectPartName = ?)",
- m_database
- };
-};
-
-}
diff --git a/src/plugins/clangpchmanager/precompiledheaderstorageinterface.h b/src/plugins/clangpchmanager/precompiledheaderstorageinterface.h
deleted file mode 100644
index 1c834acbd3..0000000000
--- a/src/plugins/clangpchmanager/precompiledheaderstorageinterface.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include <utils/smallstringview.h>
-
-namespace ClangPchManager {
-
-class PrecompiledHeaderStorageInterface
-{
-public:
- PrecompiledHeaderStorageInterface() = default;
-
- PrecompiledHeaderStorageInterface(const PrecompiledHeaderStorageInterface&) = delete;
- PrecompiledHeaderStorageInterface &operator=(const PrecompiledHeaderStorageInterface&) = delete;
-
- virtual void insertPrecompiledHeader(Utils::SmallStringView projectPartName,
- Utils::SmallStringView pchPath,
- long long pchBuildTime) = 0;
-
- virtual void deletePrecompiledHeader(Utils::SmallStringView projectPartName) = 0;
-
-protected:
- ~PrecompiledHeaderStorageInterface() = default;
-};
-
-} // namespace ClangPchManager
diff --git a/src/plugins/clangpchmanager/projectupdater.cpp b/src/plugins/clangpchmanager/projectupdater.cpp
index 81d140d3f7..a3fbb6cb62 100644
--- a/src/plugins/clangpchmanager/projectupdater.cpp
+++ b/src/plugins/clangpchmanager/projectupdater.cpp
@@ -72,9 +72,10 @@ void ProjectUpdater::updateProjectParts(const std::vector<CppTools::ProjectPart
void ProjectUpdater::removeProjectParts(const QStringList &projectPartIds)
{
- ClangBackEnd::RemoveProjectPartsMessage message{Utils::SmallStringVector(projectPartIds)};
+ Utils::SmallStringVector sortedIds(projectPartIds);
+ std::sort(sortedIds.begin(), sortedIds.end());
- m_server.removeProjectParts(std::move(message));
+ m_server.removeProjectParts(ClangBackEnd::RemoveProjectPartsMessage{std::move(sortedIds)});
}
void ProjectUpdater::updateGeneratedFiles(ClangBackEnd::V2::FileContainers &&generatedFiles)