From 078ca0cdff2379bc9b4729b93e49f709ed873c75 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 26 May 2020 17:45:35 +0200 Subject: [PATCH] ClangTools: Work around clazy-standalone behavior fluctuation Some versions expect an argument after the -supported-checks-json option, and some don't. They are not easily identifiable, so we try both versions of the command line. Change-Id: I5b265e4ddd4a21c238228dafc60cbc09194f23cc Reviewed-by: Nikolai Kosjar --- src/plugins/clangtools/executableinfo.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/clangtools/executableinfo.cpp b/src/plugins/clangtools/executableinfo.cpp index f15348c7313..84c60990942 100644 --- a/src/plugins/clangtools/executableinfo.cpp +++ b/src/plugins/clangtools/executableinfo.cpp @@ -98,8 +98,13 @@ static QStringList queryClangTidyChecks(const QString &executable, static ClazyChecks querySupportedClazyChecks(const QString &executablePath) { - const CommandLine commandLine(executablePath, {"-supported-checks-json"}); - const QString jsonOutput = runExecutable(commandLine); + static const QString queryFlag = "-supported-checks-json"; + QString jsonOutput = runExecutable(CommandLine(executablePath, {queryFlag})); + + // Some clazy 1.6.x versions have a bug where they expect an argument after the + // option. + if (jsonOutput.isEmpty()) + jsonOutput = runExecutable(CommandLine(executablePath, {queryFlag, "dummy"})); if (jsonOutput.isEmpty()) return {};