Clang: Add Process Generator

So far we only compiled the precompiled headers only sequentially. The
process generator is creating, managing a queue of processes to compile
the PCHs parallel.

Change-Id: I8075def4ef9e6b0191bbd51b3631d1c51ec7b361
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2017-01-31 14:21:05 +01:00
parent 92263a0535
commit ea4141ee14
23 changed files with 884 additions and 95 deletions

View File

@@ -27,6 +27,7 @@
#include <connectionserver.h>
#include <environment.h>
#include <pchcreator.h>
#include <pchgenerator.h>
#include <pchmanagerserver.h>
#include <pchmanagerclientproxy.h>
#include <projectparts.h>
@@ -36,12 +37,16 @@
#include <QCoreApplication>
#include <QFileSystemWatcher>
#include <QLoggingCategory>
#include <QProcess>
#include <QTemporaryDir>
#include <QTimer>
#include <thread>
using ClangBackEnd::ClangPathWatcher;
using ClangBackEnd::ConnectionServer;
using ClangBackEnd::PchCreator;
using ClangBackEnd::PchGenerator;
using ClangBackEnd::PchManagerClientProxy;
using ClangBackEnd::PchManagerServer;
using ClangBackEnd::ProjectParts;
@@ -60,6 +65,11 @@ public:
return QString(CLANG_COMPILER_PATH);
}
uint hardwareConcurrency() const
{
return std::thread::hardware_concurrency();
}
private:
QTemporaryDir temporaryDirectory;
};
@@ -96,13 +106,17 @@ int main(int argc, char *argv[])
StringCache<Utils::SmallString> filePathCache;
ClangPathWatcher<QFileSystemWatcher, QTimer> includeWatcher(filePathCache);
ApplicationEnvironment environment;
PchGenerator<QProcess> pchGenerator(environment);
PchCreator pchCreator(environment, filePathCache);
pchCreator.setGenerator(&pchGenerator);
ProjectParts projectParts;
PchManagerServer clangPchManagerServer(filePathCache,
includeWatcher,
pchCreator,
projectParts);
includeWatcher.setNotifier(&clangPchManagerServer);
pchGenerator.setNotifier(&clangPchManagerServer);
ConnectionServer<PchManagerServer, PchManagerClientProxy> connectionServer(connection);
connectionServer.start();
connectionServer.setServer(&clangPchManagerServer);