diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-05-26 17:45:35 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-05-27 13:26:03 +0000 |
commit | 078ca0cdff2379bc9b4729b93e49f709ed873c75 (patch) | |
tree | 44b19ffb2719cf4936b2204199a2dcc3f18e3838 | |
parent | 6c4b8b10b7cf18497c454acf00b5de6b412708d6 (diff) | |
download | qt-creator-078ca0cdff2379bc9b4729b93e49f709ed873c75.tar.gz |
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>
-rw-r--r-- | src/plugins/clangtools/executableinfo.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/clangtools/executableinfo.cpp b/src/plugins/clangtools/executableinfo.cpp index f15348c731..84c6099094 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 {}; |