forked from qt-creator/qt-creator
DiagnosticMark: Replace source field with ClangToolType
Replace also the AnalyzeOutputData::toolName field with ClangToolType toolType. Stop relying on comparing translatable strings inside DocumentClangToolRunner::onDone(). Change-Id: I1b69619fe9283622ed478973ee3a5e9cf8f4c309 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -163,7 +163,7 @@ TaskItem clangToolTask(const AnalyzeInputData &input,
|
||||
if (!outputHandler)
|
||||
return;
|
||||
const ClangToolStorage *data = storage.activeStorage();
|
||||
outputHandler({true, input.unit.file, data->outputFilePath, data->name});
|
||||
outputHandler({true, input.unit.file, data->outputFilePath, input.tool});
|
||||
};
|
||||
const auto onProcessError = [=](const QtcProcess &process) {
|
||||
if (!outputHandler)
|
||||
@@ -180,7 +180,7 @@ TaskItem clangToolTask(const AnalyzeInputData &input,
|
||||
message = Tr::tr("%1 finished with exit code: %2.").arg(data->name).arg(process.exitCode());
|
||||
else
|
||||
message = Tr::tr("%1 crashed.").arg(data->name);
|
||||
outputHandler({false, input.unit.file, data->outputFilePath, data->name, message, details});
|
||||
outputHandler({false, input.unit.file, data->outputFilePath, input.tool, message, details});
|
||||
};
|
||||
|
||||
const Group group {
|
||||
|
@@ -39,7 +39,7 @@ struct AnalyzeOutputData
|
||||
bool success = true;
|
||||
QString fileToAnalyze;
|
||||
QString outputFilePath;
|
||||
QString toolName;
|
||||
CppEditor::ClangToolType toolType;
|
||||
QString errorMessage = {};
|
||||
QString errorDetails = {};
|
||||
};
|
||||
|
@@ -5,12 +5,12 @@
|
||||
|
||||
#include "clangtoolsdiagnostic.h"
|
||||
|
||||
#include <cppeditor/clangdiagnosticconfig.h>
|
||||
#include <texteditor/textmark.h>
|
||||
|
||||
namespace ClangTools {
|
||||
namespace Internal {
|
||||
|
||||
|
||||
class DiagnosticMark : public TextEditor::TextMark
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ClangTools::Internal::DiagnosticMark)
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
|
||||
Diagnostic diagnostic() const;
|
||||
|
||||
QString source;
|
||||
std::optional<CppEditor::ClangToolType> toolType;
|
||||
|
||||
private:
|
||||
const Diagnostic m_diagnostic;
|
||||
|
@@ -245,10 +245,10 @@ void DocumentClangToolRunner::onDone(const AnalyzeOutputData &output)
|
||||
}
|
||||
}
|
||||
|
||||
const QString toolName = output.toolName;
|
||||
const CppEditor::ClangToolType toolType = output.toolType;
|
||||
// remove outdated marks of the current runner
|
||||
auto [toDelete, newMarks] = Utils::partition(m_marks, [toolName](DiagnosticMark *mark) {
|
||||
return mark->source == toolName; // TODO: comparison on translatable string
|
||||
const auto [toDelete, newMarks] = Utils::partition(m_marks, [toolType](DiagnosticMark *mark) {
|
||||
return mark->toolType == toolType;
|
||||
});
|
||||
m_marks = newMarks;
|
||||
qDeleteAll(toDelete);
|
||||
@@ -262,7 +262,7 @@ void DocumentClangToolRunner::onDone(const AnalyzeOutputData &output)
|
||||
continue;
|
||||
|
||||
auto mark = new DiagnosticMark(diagnostic);
|
||||
mark->source = toolName;
|
||||
mark->toolType = toolType;
|
||||
|
||||
if (doc && Utils::anyOf(diagnostic.explainingSteps, &ExplainingStep::isFixIt)) {
|
||||
TextEditor::RefactorMarker marker;
|
||||
|
Reference in New Issue
Block a user