forked from qt-creator/qt-creator
ClangTools: Remove temporary dirs
...when a new run is triggered instead of on Qt Creator shutdown. There is no reason to keep them around for longer than needed. Change-Id: Ida7698843cc2f8822ffd662679cf5da2c4ece05c Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -48,11 +48,10 @@ ClangTidyClazyRunControl::ClangTidyClazyRunControl(
|
|||||||
ClangToolRunner *ClangTidyClazyRunControl::createRunner()
|
ClangToolRunner *ClangTidyClazyRunControl::createRunner()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_clangExecutable.isEmpty(), return 0);
|
QTC_ASSERT(!m_clangExecutable.isEmpty(), return 0);
|
||||||
QTC_ASSERT(!m_clangLogFileDir.isEmpty(), return 0);
|
|
||||||
|
|
||||||
auto runner = new ClangTidyClazyRunner(m_diagnosticConfig,
|
auto runner = new ClangTidyClazyRunner(m_diagnosticConfig,
|
||||||
m_clangExecutable,
|
m_clangExecutable,
|
||||||
m_clangLogFileDir,
|
m_temporaryDir.path(),
|
||||||
m_environment,
|
m_environment,
|
||||||
this);
|
this);
|
||||||
connect(runner, &ClangTidyClazyRunner::finishedWithSuccess,
|
connect(runner, &ClangTidyClazyRunner::finishedWithSuccess,
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/checkablemessagebox.h>
|
#include <utils/checkablemessagebox.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/temporarydirectory.h>
|
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
@@ -232,6 +231,7 @@ ClangToolRunControl::ClangToolRunControl(RunControl *runControl,
|
|||||||
: RunWorker(runControl)
|
: RunWorker(runControl)
|
||||||
, m_projectBuilder(new ProjectBuilder(runControl, target->project(), this))
|
, m_projectBuilder(new ProjectBuilder(runControl, target->project(), this))
|
||||||
, m_clangExecutable(CppTools::clangExecutable(CLANG_BINDIR))
|
, m_clangExecutable(CppTools::clangExecutable(CLANG_BINDIR))
|
||||||
|
, m_temporaryDir("clangtools-XXXXXX")
|
||||||
, m_target(target)
|
, m_target(target)
|
||||||
, m_fileInfos(fileInfos)
|
, m_fileInfos(fileInfos)
|
||||||
{
|
{
|
||||||
@@ -299,9 +299,7 @@ void ClangToolRunControl::start()
|
|||||||
Utils::NormalMessageFormat);
|
Utils::NormalMessageFormat);
|
||||||
|
|
||||||
// Create log dir
|
// Create log dir
|
||||||
Utils::TemporaryDirectory temporaryDir("qtc-clangtools-XXXXXX");
|
if (!m_temporaryDir.isValid()) {
|
||||||
temporaryDir.setAutoRemove(false);
|
|
||||||
if (!temporaryDir.isValid()) {
|
|
||||||
const QString errorMessage
|
const QString errorMessage
|
||||||
= toolName + tr(": Failed to create temporary dir, stop.");
|
= toolName + tr(": Failed to create temporary dir, stop.");
|
||||||
appendMessage(errorMessage, Utils::ErrorMessageFormat);
|
appendMessage(errorMessage, Utils::ErrorMessageFormat);
|
||||||
@@ -310,7 +308,6 @@ void ClangToolRunControl::start()
|
|||||||
reportFailure(errorMessage);
|
reportFailure(errorMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_clangLogFileDir = temporaryDir.path();
|
|
||||||
|
|
||||||
// Collect files
|
// Collect files
|
||||||
const AnalyzeUnits unitsToProcess = unitsToAnalyze(CLANG_VERSION);
|
const AnalyzeUnits unitsToProcess = unitsToAnalyze(CLANG_VERSION);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <cpptools/projectinfo.h>
|
#include <cpptools/projectinfo.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
|
#include <utils/temporarydirectory.h>
|
||||||
|
|
||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@@ -90,7 +91,7 @@ protected:
|
|||||||
ProjectBuilder *m_projectBuilder;
|
ProjectBuilder *m_projectBuilder;
|
||||||
Utils::Environment m_environment;
|
Utils::Environment m_environment;
|
||||||
QString m_clangExecutable;
|
QString m_clangExecutable;
|
||||||
QString m_clangLogFileDir;
|
Utils::TemporaryDirectory m_temporaryDir;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<ProjectExplorer::Target> m_target;
|
QPointer<ProjectExplorer::Target> m_target;
|
||||||
|
|||||||
Reference in New Issue
Block a user