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 <nikolai.kosjar@qt.io>
This commit is contained in:
Christian Kandeler
2020-05-26 17:45:35 +02:00
parent 6c4b8b10b7
commit 078ca0cdff

View File

@@ -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 {};