Clang: Fix exception catching

Change-Id: I5914ee4056e821359109786190b7006ef992b60e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-03-28 13:18:39 +02:00
parent 410a2b95c4
commit 4b97126d28
3 changed files with 82 additions and 72 deletions

View File

@@ -95,39 +95,43 @@ QStringList processArguments(QCoreApplication &application)
int main(int argc, char *argv[])
{
//QLoggingCategory::setFilterRules(QStringLiteral("*.debug=false"));
try {
//QLoggingCategory::setFilterRules(QStringLiteral("*.debug=false"));
QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));
QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
QCoreApplication::setApplicationName(QStringLiteral("ClangPchManagerBackend"));
QCoreApplication::setApplicationVersion(QStringLiteral("0.1.0"));
QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));
QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
QCoreApplication::setApplicationName(QStringLiteral("ClangPchManagerBackend"));
QCoreApplication::setApplicationVersion(QStringLiteral("0.1.0"));
QCoreApplication application(argc, argv);
QCoreApplication application(argc, argv);
const QStringList arguments = processArguments(application);
const QString connectionName = arguments[0];
const QString databasePath = arguments[1];
const QStringList arguments = processArguments(application);
const QString connectionName = arguments[0];
const QString databasePath = arguments[1];
Sqlite::Database database{Utils::PathString{databasePath}};
ClangBackEnd::RefactoringDatabaseInitializer<Sqlite::Database> databaseInitializer{database};
ClangBackEnd::FilePathCaching filePathCache{database};
ClangPathWatcher<QFileSystemWatcher, QTimer> includeWatcher(filePathCache);
ApplicationEnvironment environment;
PchGenerator<QProcess> pchGenerator(environment);
PchCreator pchCreator(environment, filePathCache);
pchCreator.setGenerator(&pchGenerator);
ProjectParts projectParts;
PchManagerServer clangPchManagerServer(includeWatcher,
pchCreator,
projectParts);
includeWatcher.setNotifier(&clangPchManagerServer);
pchGenerator.setNotifier(&clangPchManagerServer);
Sqlite::Database database{Utils::PathString{databasePath}};
ClangBackEnd::RefactoringDatabaseInitializer<Sqlite::Database> databaseInitializer{database};
ClangBackEnd::FilePathCaching filePathCache{database};
ClangPathWatcher<QFileSystemWatcher, QTimer> includeWatcher(filePathCache);
ApplicationEnvironment environment;
PchGenerator<QProcess> pchGenerator(environment);
PchCreator pchCreator(environment, filePathCache);
pchCreator.setGenerator(&pchGenerator);
ProjectParts projectParts;
PchManagerServer clangPchManagerServer(includeWatcher,
pchCreator,
projectParts);
includeWatcher.setNotifier(&clangPchManagerServer);
pchGenerator.setNotifier(&clangPchManagerServer);
ConnectionServer<PchManagerServer, PchManagerClientProxy> connectionServer;
connectionServer.setServer(&clangPchManagerServer);
connectionServer.start(connectionName);
ConnectionServer<PchManagerServer, PchManagerClientProxy> connectionServer;
connectionServer.setServer(&clangPchManagerServer);
connectionServer.start(connectionName);
return application.exec();
return application.exec();
} catch (const Sqlite::Exception &exception) {
exception.printWarning();
}
}