forked from qt-creator/qt-creator
Merge "Merge remote-tracking branch 'origin/4.10'"
This commit is contained in:
@@ -43,11 +43,8 @@ void PchManagerClient::alive()
|
||||
|
||||
void PchManagerClient::precompiledHeadersUpdated(ClangBackEnd::PrecompiledHeadersUpdatedMessage &&message)
|
||||
{
|
||||
for (ClangBackEnd::ProjectPartPch &projectPartPch : message.takeProjectPartPchs()) {
|
||||
const QString pchPath{projectPartPch.pchPath};
|
||||
addProjectPartPch(std::move(projectPartPch));
|
||||
precompiledHeaderUpdated(projectPartPch.projectPartId, pchPath, projectPartPch.lastModified);
|
||||
}
|
||||
for (ClangBackEnd::ProjectPartId &projectPartId : message.takeProjectPartIds())
|
||||
precompiledHeaderUpdated(projectPartId);
|
||||
}
|
||||
|
||||
void PchManagerClient::progress(ClangBackEnd::ProgressMessage &&message)
|
||||
@@ -66,10 +63,8 @@ void PchManagerClient::progress(ClangBackEnd::ProgressMessage &&message)
|
||||
|
||||
void PchManagerClient::precompiledHeaderRemoved(ClangBackEnd::ProjectPartId projectPartId)
|
||||
{
|
||||
for (auto notifier : m_notifiers) {
|
||||
removeProjectPartPch(projectPartId);
|
||||
for (auto notifier : m_notifiers)
|
||||
notifier->precompiledHeaderRemoved(projectPartId);
|
||||
}
|
||||
}
|
||||
|
||||
void PchManagerClient::setConnectionClient(PchManagerConnectionClient *connectionClient)
|
||||
@@ -77,22 +72,6 @@ void PchManagerClient::setConnectionClient(PchManagerConnectionClient *connectio
|
||||
m_connectionClient = connectionClient;
|
||||
}
|
||||
|
||||
Utils::optional<ClangBackEnd::ProjectPartPch> PchManagerClient::projectPartPch(
|
||||
ClangBackEnd::ProjectPartId projectPartId) const
|
||||
{
|
||||
auto found = std::lower_bound(m_projectPartPchs.cbegin(),
|
||||
m_projectPartPchs.cend(),
|
||||
projectPartId,
|
||||
[] (const auto &projectPartPch, auto projectPartId) {
|
||||
return projectPartId < projectPartPch.projectPartId;
|
||||
});
|
||||
|
||||
if (found != m_projectPartPchs.end() && found->projectPartId == projectPartId)
|
||||
return *found;
|
||||
|
||||
return Utils::nullopt;
|
||||
}
|
||||
|
||||
void PchManagerClient::attach(PchManagerNotifierInterface *notifier)
|
||||
{
|
||||
m_notifiers.push_back(notifier);
|
||||
@@ -109,47 +88,15 @@ void PchManagerClient::detach(PchManagerNotifierInterface *notifierToBeDeleted)
|
||||
m_notifiers.erase(newEnd, m_notifiers.end());
|
||||
}
|
||||
|
||||
void PchManagerClient::removeProjectPartPch(ClangBackEnd::ProjectPartId projectPartId)
|
||||
{
|
||||
auto found = std::lower_bound(m_projectPartPchs.begin(),
|
||||
m_projectPartPchs.end(),
|
||||
projectPartId,
|
||||
[] (const auto &projectPartPch, auto projectPartId) {
|
||||
return projectPartId < projectPartPch.projectPartId;
|
||||
});
|
||||
|
||||
if (found != m_projectPartPchs.end() && found->projectPartId == projectPartId) {
|
||||
*found = std::move(m_projectPartPchs.back());
|
||||
m_projectPartPchs.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
void PchManagerClient::addProjectPartPch(ClangBackEnd::ProjectPartPch &&projectPartPch)
|
||||
{
|
||||
auto found = std::lower_bound(m_projectPartPchs.begin(),
|
||||
m_projectPartPchs.end(),
|
||||
projectPartPch.projectPartId,
|
||||
[] (const auto &projectPartPch, auto projectPartId) {
|
||||
return projectPartId < projectPartPch.projectPartId;
|
||||
});
|
||||
|
||||
if (found != m_projectPartPchs.end() && found->projectPartId == projectPartPch.projectPartId)
|
||||
*found = std::move(projectPartPch);
|
||||
else
|
||||
m_projectPartPchs.insert(found, std::move(projectPartPch));
|
||||
}
|
||||
|
||||
const std::vector<PchManagerNotifierInterface *> &PchManagerClient::notifiers() const
|
||||
{
|
||||
return m_notifiers;
|
||||
}
|
||||
|
||||
void PchManagerClient::precompiledHeaderUpdated(ClangBackEnd::ProjectPartId projectPartId,
|
||||
const QString &pchFilePath,
|
||||
long long lastModified)
|
||||
void PchManagerClient::precompiledHeaderUpdated(ClangBackEnd::ProjectPartId projectPartId)
|
||||
{
|
||||
for (auto notifier : m_notifiers)
|
||||
notifier->precompiledHeaderUpdated(projectPartId, pchFilePath, lastModified);
|
||||
notifier->precompiledHeaderUpdated(projectPartId);
|
||||
}
|
||||
|
||||
} // namespace ClangPchManager
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "clangpchmanager_global.h"
|
||||
|
||||
#include <pchmanagerclientinterface.h>
|
||||
#include <projectpartpchproviderinterface.h>
|
||||
#include <projectpartid.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -37,8 +37,7 @@ class PchManagerConnectionClient;
|
||||
class ProgressManagerInterface;
|
||||
class PchManagerNotifierInterface;
|
||||
|
||||
class CLANGPCHMANAGER_EXPORT PchManagerClient final : public ClangBackEnd::PchManagerClientInterface,
|
||||
public ClangBackEnd::ProjectPartPchProviderInterface
|
||||
class CLANGPCHMANAGER_EXPORT PchManagerClient final : public ClangBackEnd::PchManagerClientInterface
|
||||
{
|
||||
friend class PchManagerNotifierInterface;
|
||||
public:
|
||||
@@ -56,27 +55,13 @@ public:
|
||||
|
||||
void setConnectionClient(PchManagerConnectionClient *connectionClient);
|
||||
|
||||
Utils::optional<ClangBackEnd::ProjectPartPch> projectPartPch(
|
||||
ClangBackEnd::ProjectPartId projectPartId) const override;
|
||||
|
||||
const ClangBackEnd::ProjectPartPchs &projectPartPchs() const override
|
||||
{
|
||||
return m_projectPartPchs;
|
||||
}
|
||||
|
||||
unittest_public : const std::vector<PchManagerNotifierInterface *> ¬ifiers() const;
|
||||
void precompiledHeaderUpdated(ClangBackEnd::ProjectPartId projectPartId,
|
||||
const QString &pchFilePath,
|
||||
long long lastModified);
|
||||
void precompiledHeaderUpdated(ClangBackEnd::ProjectPartId projectPartId);
|
||||
|
||||
void attach(PchManagerNotifierInterface *notifier);
|
||||
void detach(PchManagerNotifierInterface *notifier);
|
||||
|
||||
void addProjectPartPch(ClangBackEnd::ProjectPartPch &&projectPartPch);
|
||||
void removeProjectPartPch(ClangBackEnd::ProjectPartId projectPartId);
|
||||
|
||||
private:
|
||||
ClangBackEnd::ProjectPartPchs m_projectPartPchs;
|
||||
std::vector<PchManagerNotifierInterface*> m_notifiers;
|
||||
PchManagerConnectionClient *m_connectionClient=nullptr;
|
||||
ProgressManagerInterface &m_pchCreationProgressManager;
|
||||
|
||||
@@ -42,10 +42,7 @@ public:
|
||||
PchManagerNotifierInterface(const PchManagerNotifierInterface &) = delete;
|
||||
PchManagerNotifierInterface &operator=(const PchManagerNotifierInterface &) = delete;
|
||||
|
||||
virtual void precompiledHeaderUpdated(ClangBackEnd::ProjectPartId projectPartId,
|
||||
const QString &pchFilePath,
|
||||
long long lastModified)
|
||||
= 0;
|
||||
virtual void precompiledHeaderUpdated(ClangBackEnd::ProjectPartId projectPartId) = 0;
|
||||
virtual void precompiledHeaderRemoved(ClangBackEnd::ProjectPartId projectPartId) = 0;
|
||||
|
||||
PchManagerClient &m_pchManagerClient;
|
||||
|
||||
Reference in New Issue
Block a user