forked from qt-creator/qt-creator
ClangTools: Rename *RunControls to *RunWorkers
That's what they are. Change-Id: Icc167e87678f5888090d737325ac0067e6b3ea92 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -33,26 +33,26 @@ using namespace ProjectExplorer;
|
|||||||
namespace ClangTools {
|
namespace ClangTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ClangTidyClazyRunControl::ClangTidyClazyRunControl(
|
ClangTidyClazyRunWorker::ClangTidyClazyRunWorker(
|
||||||
RunControl *runControl,
|
RunControl *runControl,
|
||||||
Target *target,
|
Target *target,
|
||||||
const CppTools::ClangDiagnosticConfig &diagnosticConfig,
|
const CppTools::ClangDiagnosticConfig &diagnosticConfig,
|
||||||
const FileInfos &fileInfos)
|
const FileInfos &fileInfos)
|
||||||
: ClangToolRunControl(runControl, target, fileInfos)
|
: ClangToolRunWorker(runControl, target, fileInfos)
|
||||||
, m_diagnosticConfig(diagnosticConfig)
|
, m_diagnosticConfig(diagnosticConfig)
|
||||||
{
|
{
|
||||||
setId("ClangTidyClazyRunner");
|
setId("ClangTidyClazyRunner");
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<RunnerCreator> ClangTidyClazyRunControl::runnerCreators()
|
QList<RunnerCreator> ClangTidyClazyRunWorker::runnerCreators()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
[this]() { return createRunner(); }
|
[this]() { return createRunner(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ClangToolRunner *ClangTidyClazyRunControl::createRunner()
|
ClangToolRunner *ClangTidyClazyRunWorker::createRunner()
|
||||||
{
|
{
|
||||||
auto runner = new ClangTidyClazyRunner(m_diagnosticConfig,
|
auto runner = new ClangTidyClazyRunner(m_diagnosticConfig,
|
||||||
m_clangExecutable,
|
m_clangExecutable,
|
||||||
@@ -60,13 +60,13 @@ ClangToolRunner *ClangTidyClazyRunControl::createRunner()
|
|||||||
m_environment,
|
m_environment,
|
||||||
this);
|
this);
|
||||||
connect(runner, &ClangToolRunner::finishedWithSuccess,
|
connect(runner, &ClangToolRunner::finishedWithSuccess,
|
||||||
this, &ClangTidyClazyRunControl::onRunnerFinishedWithSuccess);
|
this, &ClangTidyClazyRunWorker::onRunnerFinishedWithSuccess);
|
||||||
connect(runner, &ClangToolRunner::finishedWithFailure,
|
connect(runner, &ClangToolRunner::finishedWithFailure,
|
||||||
this, &ClangTidyClazyRunControl::onRunnerFinishedWithFailure);
|
this, &ClangTidyClazyRunWorker::onRunnerFinishedWithFailure);
|
||||||
return runner;
|
return runner;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClangTool *ClangTidyClazyRunControl::tool()
|
ClangTool *ClangTidyClazyRunWorker::tool()
|
||||||
{
|
{
|
||||||
return ClangTidyClazyTool::instance();
|
return ClangTidyClazyTool::instance();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,15 +32,15 @@
|
|||||||
namespace ClangTools {
|
namespace ClangTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ClangTidyClazyRunControl final : public ClangToolRunControl
|
class ClangTidyClazyRunWorker final : public ClangToolRunWorker
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClangTidyClazyRunControl(ProjectExplorer::RunControl *runControl,
|
ClangTidyClazyRunWorker(ProjectExplorer::RunControl *runControl,
|
||||||
ProjectExplorer::Target *target,
|
ProjectExplorer::Target *target,
|
||||||
const CppTools::ClangDiagnosticConfig &diagnosticConfig,
|
const CppTools::ClangDiagnosticConfig &diagnosticConfig,
|
||||||
const FileInfos &fileInfos);
|
const FileInfos &fileInfos);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QList<RunnerCreator> runnerCreators() final;
|
QList<RunnerCreator> runnerCreators() final;
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ void ClangTidyClazyTool::startTool(bool askUserForFileSelection)
|
|||||||
if (fileInfos.empty())
|
if (fileInfos.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto clangTool = new ClangTidyClazyRunControl(runControl,
|
auto clangTool = new ClangTidyClazyRunWorker(runControl,
|
||||||
project->activeTarget(),
|
project->activeTarget(),
|
||||||
getDiagnosticConfig(project),
|
getDiagnosticConfig(project),
|
||||||
fileInfos);
|
fileInfos);
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Internal {
|
|||||||
class ProjectBuilder : public RunWorker
|
class ProjectBuilder : public RunWorker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProjectBuilder(RunControl *runControl, Project *project, ClangToolRunControl *parent)
|
ProjectBuilder(RunControl *runControl, Project *project, ClangToolRunWorker *parent)
|
||||||
: RunWorker(runControl), m_project(project), m_parent(parent)
|
: RunWorker(runControl), m_project(project), m_parent(parent)
|
||||||
{
|
{
|
||||||
setId("ProjectBuilder");
|
setId("ProjectBuilder");
|
||||||
@@ -144,14 +144,14 @@ private:
|
|||||||
buildType = buildConfig->buildType();
|
buildType = buildConfig->buildType();
|
||||||
|
|
||||||
if (buildType == BuildConfiguration::Release) {
|
if (buildType == BuildConfiguration::Release) {
|
||||||
const QString wrongMode = ClangToolRunControl::tr("Release");
|
const QString wrongMode = ClangToolRunWorker::tr("Release");
|
||||||
const QString toolName = m_parent->tool()->name();
|
const QString toolName = m_parent->tool()->name();
|
||||||
const QString title = ClangToolRunControl::tr("Run %1 in %2 Mode?").arg(toolName, wrongMode);
|
const QString title = ClangToolRunWorker::tr("Run %1 in %2 Mode?").arg(toolName, wrongMode);
|
||||||
const QString problem = ClangToolRunControl::tr(
|
const QString problem = ClangToolRunWorker::tr(
|
||||||
"You are trying to run the tool \"%1\" on an application in %2 mode. The tool is "
|
"You are trying to run the tool \"%1\" on an application in %2 mode. The tool is "
|
||||||
"designed to be used in Debug mode since enabled assertions can reduce the number of "
|
"designed to be used in Debug mode since enabled assertions can reduce the number of "
|
||||||
"false positives.").arg(toolName, wrongMode);
|
"false positives.").arg(toolName, wrongMode);
|
||||||
const QString question = ClangToolRunControl::tr(
|
const QString question = ClangToolRunWorker::tr(
|
||||||
"Do you want to continue and run the tool in %1 mode?").arg(wrongMode);
|
"Do you want to continue and run the tool in %1 mode?").arg(wrongMode);
|
||||||
const QString message = QString("<html><head/><body>"
|
const QString message = QString("<html><head/><body>"
|
||||||
"<p>%1</p>"
|
"<p>%1</p>"
|
||||||
@@ -182,7 +182,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<Project> m_project;
|
QPointer<Project> m_project;
|
||||||
ClangToolRunControl *m_parent;
|
ClangToolRunWorker *m_parent;
|
||||||
bool m_enabled = true;
|
bool m_enabled = true;
|
||||||
bool m_success = false;
|
bool m_success = false;
|
||||||
};
|
};
|
||||||
@@ -208,7 +208,7 @@ static AnalyzeUnits toAnalyzeUnits(const FileInfos &fileInfos)
|
|||||||
return unitsToAnalyze;
|
return unitsToAnalyze;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzeUnits ClangToolRunControl::unitsToAnalyze()
|
AnalyzeUnits ClangToolRunWorker::unitsToAnalyze()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_projectInfo.isValid(), return AnalyzeUnits());
|
QTC_ASSERT(m_projectInfo.isValid(), return AnalyzeUnits());
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ static QDebug operator<<(QDebug debug, const AnalyzeUnits &analyzeUnits)
|
|||||||
return debug;
|
return debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClangToolRunControl::ClangToolRunControl(RunControl *runControl,
|
ClangToolRunWorker::ClangToolRunWorker(RunControl *runControl,
|
||||||
Target *target,
|
Target *target,
|
||||||
const FileInfos &fileInfos)
|
const FileInfos &fileInfos)
|
||||||
: RunWorker(runControl)
|
: RunWorker(runControl)
|
||||||
@@ -249,7 +249,7 @@ ClangToolRunControl::ClangToolRunControl(RunControl *runControl,
|
|||||||
m_projectBuilder->setEnabled(projectSettings->buildBeforeAnalysis());
|
m_projectBuilder->setEnabled(projectSettings->buildBeforeAnalysis());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::init()
|
void ClangToolRunWorker::init()
|
||||||
{
|
{
|
||||||
setSupportsReRunning(false);
|
setSupportsReRunning(false);
|
||||||
m_projectInfoBeforeBuild = CppTools::CppModelManager::instance()->projectInfo(
|
m_projectInfoBeforeBuild = CppTools::CppModelManager::instance()->projectInfo(
|
||||||
@@ -266,7 +266,7 @@ void ClangToolRunControl::init()
|
|||||||
m_toolChainType = toolChain->typeId();
|
m_toolChainType = toolChain->typeId();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::start()
|
void ClangToolRunWorker::start()
|
||||||
{
|
{
|
||||||
TaskHub::clearTasks(Debugger::Constants::ANALYZERTASK_ID);
|
TaskHub::clearTasks(Debugger::Constants::ANALYZERTASK_ID);
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ void ClangToolRunControl::start()
|
|||||||
toolName.toStdString().c_str());
|
toolName.toStdString().c_str());
|
||||||
futureProgress->setKeepOnFinish(FutureProgress::HideOnFinish);
|
futureProgress->setKeepOnFinish(FutureProgress::HideOnFinish);
|
||||||
connect(futureProgress, &FutureProgress::canceled,
|
connect(futureProgress, &FutureProgress::canceled,
|
||||||
this, &ClangToolRunControl::onProgressCanceled);
|
this, &ClangToolRunWorker::onProgressCanceled);
|
||||||
m_progress.setProgressRange(0, m_initialQueueSize);
|
m_progress.setProgressRange(0, m_initialQueueSize);
|
||||||
m_progress.reportStarted();
|
m_progress.reportStarted();
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ void ClangToolRunControl::start()
|
|||||||
analyzeNextFile();
|
analyzeNextFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::stop()
|
void ClangToolRunWorker::stop()
|
||||||
{
|
{
|
||||||
for (ClangToolRunner *runner : m_runners) {
|
for (ClangToolRunner *runner : m_runners) {
|
||||||
QObject::disconnect(runner, nullptr, this, nullptr);
|
QObject::disconnect(runner, nullptr, this, nullptr);
|
||||||
@@ -373,7 +373,7 @@ void ClangToolRunControl::stop()
|
|||||||
reportStopped();
|
reportStopped();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::analyzeNextFile()
|
void ClangToolRunWorker::analyzeNextFile()
|
||||||
{
|
{
|
||||||
if (m_progress.isFinished())
|
if (m_progress.isFinished())
|
||||||
return; // The previous call already reported that we are finished.
|
return; // The previous call already reported that we are finished.
|
||||||
@@ -396,7 +396,7 @@ void ClangToolRunControl::analyzeNextFile()
|
|||||||
Utils::StdOutFormat);
|
Utils::StdOutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath)
|
void ClangToolRunWorker::onRunnerFinishedWithSuccess(const QString &filePath)
|
||||||
{
|
{
|
||||||
const QString logFilePath = qobject_cast<ClangToolRunner *>(sender())->logFilePath();
|
const QString logFilePath = qobject_cast<ClangToolRunner *>(sender())->logFilePath();
|
||||||
qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath;
|
qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath;
|
||||||
@@ -425,7 +425,7 @@ void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath)
|
|||||||
handleFinished();
|
handleFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::onRunnerFinishedWithFailure(const QString &errorMessage,
|
void ClangToolRunWorker::onRunnerFinishedWithFailure(const QString &errorMessage,
|
||||||
const QString &errorDetails)
|
const QString &errorDetails)
|
||||||
{
|
{
|
||||||
qCDebug(LOG).noquote() << "onRunnerFinishedWithFailure:"
|
qCDebug(LOG).noquote() << "onRunnerFinishedWithFailure:"
|
||||||
@@ -449,7 +449,7 @@ void ClangToolRunControl::onRunnerFinishedWithFailure(const QString &errorMessag
|
|||||||
handleFinished();
|
handleFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::handleFinished()
|
void ClangToolRunWorker::handleFinished()
|
||||||
{
|
{
|
||||||
m_runners.remove(qobject_cast<ClangToolRunner *>(sender()));
|
m_runners.remove(qobject_cast<ClangToolRunner *>(sender()));
|
||||||
updateProgressValue();
|
updateProgressValue();
|
||||||
@@ -457,18 +457,18 @@ void ClangToolRunControl::handleFinished()
|
|||||||
analyzeNextFile();
|
analyzeNextFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::onProgressCanceled()
|
void ClangToolRunWorker::onProgressCanceled()
|
||||||
{
|
{
|
||||||
m_progress.reportCanceled();
|
m_progress.reportCanceled();
|
||||||
runControl()->initiateStop();
|
runControl()->initiateStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::updateProgressValue()
|
void ClangToolRunWorker::updateProgressValue()
|
||||||
{
|
{
|
||||||
m_progress.setProgressValue(m_initialQueueSize - m_queue.size());
|
m_progress.setProgressValue(m_initialQueueSize - m_queue.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::finalize()
|
void ClangToolRunWorker::finalize()
|
||||||
{
|
{
|
||||||
const QString toolName = tool()->name();
|
const QString toolName = tool()->name();
|
||||||
appendMessage(tr("%1 finished: "
|
appendMessage(tr("%1 finished: "
|
||||||
|
|||||||
@@ -60,14 +60,14 @@ struct QueueItem {
|
|||||||
};
|
};
|
||||||
using QueueItems = QList<QueueItem>;
|
using QueueItems = QList<QueueItem>;
|
||||||
|
|
||||||
class ClangToolRunControl : public ProjectExplorer::RunWorker
|
class ClangToolRunWorker : public ProjectExplorer::RunWorker
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClangToolRunControl(ProjectExplorer::RunControl *runControl,
|
ClangToolRunWorker(ProjectExplorer::RunControl *runControl,
|
||||||
ProjectExplorer::Target *target,
|
ProjectExplorer::Target *target,
|
||||||
const FileInfos &fileInfos);
|
const FileInfos &fileInfos);
|
||||||
|
|
||||||
bool success() const { return m_success; } // For testing.
|
bool success() const { return m_success; } // For testing.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user