ClangTools: Cache information about the clazy executable

Fixes: QTCREATORBUG-26237
Change-Id: I43203d58b8ed278664427e3b4112a7c7848354b9
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-09-08 12:08:55 +02:00
parent 2d77922856
commit bf275331dd
5 changed files with 32 additions and 5 deletions

View File

@@ -1140,7 +1140,7 @@ QString removeClangTidyCheck(const QString &checks, const QString &check)
QString removeClazyCheck(const QString &checks, const QString &check)
{
const ClazyStandaloneInfo clazyInfo(clazyStandaloneExecutable());
const ClazyStandaloneInfo clazyInfo = ClazyStandaloneInfo::getInfo(clazyStandaloneExecutable());
ClazyChecksTreeModel model(clazyInfo.supportedChecks);
model.enableChecks(checks.split(',', Qt::SkipEmptyParts));
const QModelIndex index = model.indexForName(check.mid(QString("clazy-").length()));
@@ -1190,7 +1190,8 @@ void disableChecks(const QList<Diagnostic> &diagnostics)
if (diag.name.startsWith("clazy-")) {
if (config.clazyMode() == ClangDiagnosticConfig::ClazyMode::UseDefaultChecks) {
config.setClazyMode(ClangDiagnosticConfig::ClazyMode::UseCustomChecks);
const ClazyStandaloneInfo clazyInfo(clazyStandaloneExecutable());
const ClazyStandaloneInfo clazyInfo
= ClazyStandaloneInfo::getInfo(clazyStandaloneExecutable());
config.setClazyChecks(clazyInfo.defaultChecks.join(','));
}
config.setClazyChecks(removeClazyCheck(config.clazyChecks(), diag.name));