forked from qt-creator/qt-creator
ClangTools: Do not spam the warning pane with long messages
The user does not usually need the whole command line. Task-number: QTCREATORBUG-20707 Change-Id: I30cd395cd85eb0a3dd19b9d5f1b34a1c7a4b95a5 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -406,22 +406,25 @@ void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClangToolRunControl::onRunnerFinishedWithFailure(const QString &errorMessage,
|
void ClangToolRunControl::onRunnerFinishedWithFailure(const QString &errorMessage,
|
||||||
const QString &errorDetails)
|
const QString &errorDetails)
|
||||||
{
|
{
|
||||||
qCDebug(LOG).noquote() << "onRunnerFinishedWithFailure:"
|
qCDebug(LOG).noquote() << "onRunnerFinishedWithFailure:"
|
||||||
<< errorMessage << '\n' << errorDetails;
|
<< errorMessage << '\n' << errorDetails;
|
||||||
|
|
||||||
|
auto *toolRunner = qobject_cast<ClangToolRunner *>(sender());
|
||||||
|
const QString filePath = toolRunner->filePath();
|
||||||
|
const QString logFilePath = toolRunner->logFilePath();
|
||||||
|
|
||||||
// Even in the error case the log file was created, so clean it up here, too.
|
// Even in the error case the log file was created, so clean it up here, too.
|
||||||
QFile::remove(qobject_cast<ClangToolRunner *>(sender())->logFilePath());
|
QFile::remove(logFilePath);
|
||||||
|
|
||||||
|
const QString message = tr("Failed to analyze \"%1\": %2").arg(filePath, errorMessage);
|
||||||
|
|
||||||
++m_filesNotAnalyzed;
|
++m_filesNotAnalyzed;
|
||||||
m_success = false;
|
m_success = false;
|
||||||
const QString filePath = qobject_cast<ClangToolRunner *>(sender())->filePath();
|
appendMessage(message, Utils::StdErrFormat);
|
||||||
appendMessage(tr("Failed to analyze \"%1\": %2").arg(filePath, errorMessage),
|
|
||||||
Utils::StdErrFormat);
|
|
||||||
appendMessage(errorDetails, Utils::StdErrFormat);
|
appendMessage(errorDetails, Utils::StdErrFormat);
|
||||||
TaskHub::addTask(Task::Warning, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
|
TaskHub::addTask(Task::Warning, message, Debugger::Constants::ANALYZERTASK_ID);
|
||||||
TaskHub::addTask(Task::Warning, errorDetails, Debugger::Constants::ANALYZERTASK_ID);
|
|
||||||
handleFinished();
|
handleFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -263,7 +263,7 @@ static QVariant iconData(const QString &type)
|
|||||||
{
|
{
|
||||||
if (type == "warning")
|
if (type == "warning")
|
||||||
return Utils::Icons::CODEMODEL_WARNING.icon();
|
return Utils::Icons::CODEMODEL_WARNING.icon();
|
||||||
if (type == "error")
|
if (type == "error" || type == "fatal")
|
||||||
return Utils::Icons::CODEMODEL_ERROR.icon();
|
return Utils::Icons::CODEMODEL_ERROR.icon();
|
||||||
if (type == "note")
|
if (type == "note")
|
||||||
return Utils::Icons::BOOKMARK.icon();
|
return Utils::Icons::BOOKMARK.icon();
|
||||||
|
Reference in New Issue
Block a user