forked from qt-creator/qt-creator
ClangTool: Pass AnalyzeUnit to clang setup handler
Change-Id: I4cfbe5c241fcf8d42e5ad597db1dd84bff439ec4 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -762,14 +762,12 @@ Group ClangTool::runRecipe(const RunSettings &runSettings,
|
||||
if (!diagnosticConfig.isEnabled(tool) && !runSettings.hasConfigFileForSourceFile(unit.file))
|
||||
continue;
|
||||
|
||||
const auto setupHandler = [this, unit, tool] {
|
||||
const auto setupHandler = [this, tool](const AnalyzeUnit &unit) {
|
||||
const QString filePath = unit.file.toUserOutput();
|
||||
m_runControl->postMessage(Tr::tr("Analyzing \"%1\" [%2].")
|
||||
.arg(filePath, clangToolName(tool)), StdOutFormat);
|
||||
return true;
|
||||
};
|
||||
const AnalyzeInputData input{tool, runSettings, diagnosticConfig, tempDir->path(),
|
||||
environment, unit};
|
||||
const auto outputHandler = [this, runSettings](const AnalyzeOutputData &output) {
|
||||
if (!output.success) {
|
||||
qCDebug(LOG).noquote() << "Clang tool task finished with an error:"
|
||||
@@ -799,6 +797,8 @@ Group ClangTool::runRecipe(const RunSettings &runSettings,
|
||||
}
|
||||
updateForCurrentState();
|
||||
};
|
||||
const AnalyzeInputData input{tool, runSettings, diagnosticConfig, tempDir->path(),
|
||||
environment, unit};
|
||||
tasks.append(clangToolTask(input, setupHandler, outputHandler));
|
||||
}
|
||||
taskTree.setRecipe(tasks);
|
||||
|
@@ -131,7 +131,7 @@ GroupItem clangToolTask(const AnalyzeInputData &input,
|
||||
};
|
||||
|
||||
const auto onSetup = [storage, input, setupHandler] {
|
||||
if (setupHandler && !setupHandler())
|
||||
if (setupHandler && !setupHandler(input.unit))
|
||||
return SetupResult::StopWithError;
|
||||
|
||||
ClangToolStorage *data = storage.activeStorage();
|
||||
|
@@ -51,7 +51,7 @@ struct AnalyzeOutputData
|
||||
QString errorDetails = {};
|
||||
};
|
||||
|
||||
using AnalyzeSetupHandler = std::function<bool()>;
|
||||
using AnalyzeSetupHandler = std::function<bool(const AnalyzeUnit &)>;
|
||||
using AnalyzeOutputHandler = std::function<void(const AnalyzeOutputData &)>;
|
||||
|
||||
Tasking::GroupItem clangToolTask(const AnalyzeInputData &input,
|
||||
|
@@ -212,7 +212,7 @@ void DocumentClangToolRunner::run()
|
||||
unit,
|
||||
vfso().overlayFilePath().toString(),
|
||||
diagnosticFilter};
|
||||
const auto setupHandler = [this, executable] {
|
||||
const auto setupHandler = [this, executable](const AnalyzeUnit &) {
|
||||
return !m_document->isModified() || isVFSOverlaySupported(executable);
|
||||
};
|
||||
const auto outputHandler = [this](const AnalyzeOutputData &output) { onDone(output); };
|
||||
|
Reference in New Issue
Block a user