From 3aea8658014177c6ad56f46876196a4428977909 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 31 Jan 2020 08:59:02 -0500 Subject: clang-tidy: Fix explicit --driver-mode= argument Since commit f6f4eb0907 (clang-tidy: Add driver mode argument, 2020-01-19) the `clang-tidy` tool rejects the new option: Unknown command line argument '--driver-mode=g++'. This is because we are adding the flag before the main compiler command-line. Encode it with `--extra-arg-before=` so that `clang-tidy` knows it is supposed to be part of the compiler command. Suggested-by: Hanjiang Yu --- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index a2fa3b1..d7e2de6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -788,7 +788,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( driverMode = lang == "C" ? "gcc" : "g++"; } run_iwyu += this->LocalGenerator->EscapeForShell( - cmStrCat(tidy, ";--driver-mode=", driverMode)); + cmStrCat(tidy, ";--extra-arg-before=--driver-mode=", driverMode)); } if (cpplint && *cpplint) { run_iwyu += " --cpplint="; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 5e8cc7d..0e74678 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -767,7 +767,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, driverMode = lang == "C" ? "gcc" : "g++"; } run_iwyu += this->GetLocalGenerator()->EscapeForShell( - cmStrCat(tidy, ";--driver-mode=", driverMode)); + cmStrCat(tidy, ";--extra-arg-before=--driver-mode=", driverMode)); } if (cpplint && *cpplint) { run_iwyu += " --cpplint="; -- cgit v0.12