diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-11-29 18:39:10 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2022-12-06 15:39:29 (GMT) |
commit | 232467eb1c0dab9156cd8c4af56aad3959cbee4b (patch) | |
tree | 2772b01850c143598e642282966401cb976dd421 /Source/cmMakefileTargetGenerator.cxx | |
parent | 7ea665b74da322e96dd3e7f90075143c2957728c (diff) | |
download | CMake-232467eb1c0dab9156cd8c4af56aad3959cbee4b.zip CMake-232467eb1c0dab9156cd8c4af56aad3959cbee4b.tar.gz CMake-232467eb1c0dab9156cd8c4af56aad3959cbee4b.tar.bz2 |
clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR property
Fixes: #21362
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 766e9f9..20cc2c3 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -25,6 +25,7 @@ #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" +#include "cmGlobalCommonGenerator.h" #include "cmGlobalUnixMakefileGenerator3.h" #include "cmLinkLineComputer.h" // IWYU pragma: keep #include "cmLocalCommonGenerator.h" @@ -1107,8 +1108,29 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( } else { driverMode = lang == "C" ? "gcc" : "g++"; } + std::string d = + this->GeneratorTarget->GetClangTidyExportFixesDirectory(lang); + std::string exportFixes; + if (!d.empty()) { + this->GlobalCommonGenerator->AddClangTidyExportFixesDir(d); + std::string fixesFile = cmSystemTools::CollapseFullPath(cmStrCat( + d, '/', + this->LocalGenerator->MaybeRelativeToTopBinDir(cmStrCat( + this->LocalGenerator->GetCurrentBinaryDirectory(), '/', + this->LocalGenerator->GetTargetDirectory( + this->GeneratorTarget), + '/', objectName, ".yaml")))); + this->GlobalCommonGenerator->AddClangTidyExportFixesFile( + fixesFile); + cmSystemTools::MakeDirectory( + cmSystemTools::GetFilenamePath(fixesFile)); + fixesFile = + this->LocalGenerator->MaybeRelativeToCurBinDir(fixesFile); + exportFixes = cmStrCat(";--export-fixes=", fixesFile); + } run_iwyu += this->LocalGenerator->EscapeForShell( - cmStrCat(*tidy, ";--extra-arg-before=--driver-mode=", driverMode)); + cmStrCat(*tidy, ";--extra-arg-before=--driver-mode=", driverMode, + exportFixes)); } if (cmNonempty(cpplint)) { run_iwyu += " --cpplint="; |