mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-29 02:19:18 -05:00
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
This commit is contained in:
@@ -788,7 +788,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
|
|||||||
driverMode = lang == "C" ? "gcc" : "g++";
|
driverMode = lang == "C" ? "gcc" : "g++";
|
||||||
}
|
}
|
||||||
run_iwyu += this->LocalGenerator->EscapeForShell(
|
run_iwyu += this->LocalGenerator->EscapeForShell(
|
||||||
cmStrCat(tidy, ";--driver-mode=", driverMode));
|
cmStrCat(tidy, ";--extra-arg-before=--driver-mode=", driverMode));
|
||||||
}
|
}
|
||||||
if (cpplint && *cpplint) {
|
if (cpplint && *cpplint) {
|
||||||
run_iwyu += " --cpplint=";
|
run_iwyu += " --cpplint=";
|
||||||
|
|||||||
@@ -767,7 +767,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
|
|||||||
driverMode = lang == "C" ? "gcc" : "g++";
|
driverMode = lang == "C" ? "gcc" : "g++";
|
||||||
}
|
}
|
||||||
run_iwyu += this->GetLocalGenerator()->EscapeForShell(
|
run_iwyu += this->GetLocalGenerator()->EscapeForShell(
|
||||||
cmStrCat(tidy, ";--driver-mode=", driverMode));
|
cmStrCat(tidy, ";--extra-arg-before=--driver-mode=", driverMode));
|
||||||
}
|
}
|
||||||
if (cpplint && *cpplint) {
|
if (cpplint && *cpplint) {
|
||||||
run_iwyu += " --cpplint=";
|
run_iwyu += " --cpplint=";
|
||||||
|
|||||||
Reference in New Issue
Block a user