forked from qt-creator/qt-creator
ClangTools: Clean up handling of output files
Do not remove the output files after the runner invocation since they will be removed later anyway due to the use of a temporary dir. For debugging, allow to prevent deleting the temporary dir. This allows easier inspection of the actually generated output files and also enables us to import the diagnostics again without actually running the tools. Change-Id: I39e04d6debc2ffa5c15e836729a4b7c7d8a3798c Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -207,6 +207,7 @@ ClangToolRunWorker::ClangToolRunWorker(RunControl *runControl,
|
||||
, m_fileInfos(fileInfos)
|
||||
, m_temporaryDir("clangtools-XXXXXX")
|
||||
{
|
||||
m_temporaryDir.setAutoRemove(qEnvironmentVariable("QTC_CLANG_DONT_DELETE_OUTPUT_FILES") != "1");
|
||||
setId("ClangTidyClazyRunner");
|
||||
setSupportsReRunning(false);
|
||||
|
||||
@@ -387,7 +388,6 @@ void ClangToolRunWorker::onRunnerFinishedWithSuccess(const QString &filePath)
|
||||
filePath,
|
||||
m_projectFiles,
|
||||
&errorMessage);
|
||||
QFile::remove(outputFilePath); // Clean-up.
|
||||
|
||||
if (!errorMessage.isEmpty()) {
|
||||
m_filesAnalyzed.remove(filePath);
|
||||
@@ -418,9 +418,6 @@ void ClangToolRunWorker::onRunnerFinishedWithFailure(const QString &errorMessage
|
||||
const QString fileToAnalyze = toolRunner->fileToAnalyze();
|
||||
const QString outputFilePath = toolRunner->outputFilePath();
|
||||
|
||||
// Even in the error case the log file was created, so clean it up here, too.
|
||||
QFile::remove(outputFilePath);
|
||||
|
||||
m_filesAnalyzed.remove(fileToAnalyze);
|
||||
m_filesNotAnalyzed.insert(fileToAnalyze);
|
||||
m_success = false;
|
||||
|
||||
Reference in New Issue
Block a user