ClangTools: Remove huge "log files" after we've read them

Serialized diagnostics consume quite a lot of space.
Remove these files after they are read by QtC.

Change-Id: I4b257e44ee182484726ebd808069198443992016
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-05-31 15:20:35 +02:00
committed by Nikolai Kosjar
parent fdd695c35c
commit 87678e9a07
4 changed files with 11 additions and 6 deletions

View File

@@ -388,13 +388,15 @@ void ClangToolRunControl::analyzeNextFile()
Utils::StdOutFormat);
}
void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath,
const QString &logFilePath)
void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath)
{
const QString logFilePath = qobject_cast<ClangToolRunner *>(sender())->actualLogFile();
qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath;
QString errorMessage;
const QList<Diagnostic> diagnostics = tool()->read(filePath, logFilePath, &errorMessage);
QFile::remove(logFilePath); // Clean-up.
if (!errorMessage.isEmpty()) {
qCDebug(LOG) << "onRunnerFinishedWithSuccess: Error reading log file:" << errorMessage;
const QString filePath = qobject_cast<ClangToolRunner *>(sender())->filePath();
@@ -415,6 +417,9 @@ void ClangToolRunControl::onRunnerFinishedWithFailure(const QString &errorMessag
qCDebug(LOG).noquote() << "onRunnerFinishedWithFailure:"
<< errorMessage << '\n' << errorDetails;
// Even in the error case the log file was created, so clean it up here, too.
QFile::remove(qobject_cast<ClangToolRunner *>(sender())->actualLogFile());
++m_filesNotAnalyzed;
m_success = false;
const QString filePath = qobject_cast<ClangToolRunner *>(sender())->filePath();