diff options
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 2faef67..80c62d1 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -3,6 +3,7 @@ #include "cmMakefileLibraryTargetGenerator.h" #include <algorithm> +#include <memory> // IWYU pragma: keep #include <sstream> #include <vector> @@ -22,7 +23,6 @@ #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cm_auto_ptr.hxx" #include "cmake.h" cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator( @@ -199,7 +199,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName); - CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer( + std::unique_ptr<cmLinkLineComputer> linkLineComputer( this->CreateLinkLineComputer( this->LocalGenerator, this->LocalGenerator->GetStateSnapshot().GetDirectory())); @@ -248,7 +248,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName); - CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer( + std::unique_ptr<cmLinkLineComputer> linkLineComputer( this->CreateLinkLineComputer( this->LocalGenerator, this->LocalGenerator->GetStateSnapshot().GetDirectory())); @@ -348,7 +348,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( std::string linkLibs; if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) { - CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer( + std::unique_ptr<cmLinkLineComputer> linkLineComputer( new cmLinkLineDeviceComputer( this->LocalGenerator, this->LocalGenerator->GetStateSnapshot().GetDirectory())); @@ -410,7 +410,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( launcher += " "; } - CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander( + std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( this->LocalGenerator->CreateRulePlaceholderExpander()); // Construct the main link rule and expand placeholders. @@ -419,11 +419,10 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( cmSystemTools::ExpandListArgument(linkRule, real_link_commands); // Expand placeholders. - for (std::vector<std::string>::iterator i = real_link_commands.begin(); - i != real_link_commands.end(); ++i) { - *i = launcher + *i; - rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i, - vars); + for (std::string& real_link_command : real_link_commands) { + real_link_command = launcher + real_link_command; + rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, + real_link_command, vars); } // Restore path conversion to normal shells. this->LocalGenerator->SetLinkScriptShell(false); @@ -755,7 +754,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string linkLibs; if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) { - CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer( + std::unique_ptr<cmLinkLineComputer> linkLineComputer( this->CreateLinkLineComputer( this->LocalGenerator, this->LocalGenerator->GetStateSnapshot().GetDirectory())); @@ -874,7 +873,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( launcher += " "; } - CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander( + std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( this->LocalGenerator->CreateRulePlaceholderExpander()); // Construct the main link rule and expand placeholders. rulePlaceholderExpander->SetTargetImpLib(targetOutPathImport); @@ -897,10 +896,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::vector<std::string>::iterator osi = object_strings.begin(); { vars.Objects = osi->c_str(); - for (std::vector<std::string>::const_iterator i = - archiveCreateCommands.begin(); - i != archiveCreateCommands.end(); ++i) { - std::string cmd = launcher + *i; + for (std::string const& acc : archiveCreateCommands) { + std::string cmd = launcher + acc; rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, cmd, vars); real_link_commands.push_back(cmd); @@ -909,10 +906,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Append to the archive with the other object sets. for (++osi; osi != object_strings.end(); ++osi) { vars.Objects = osi->c_str(); - for (std::vector<std::string>::const_iterator i = - archiveAppendCommands.begin(); - i != archiveAppendCommands.end(); ++i) { - std::string cmd = launcher + *i; + for (std::string const& aac : archiveAppendCommands) { + std::string cmd = launcher + aac; rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, cmd, vars); real_link_commands.push_back(cmd); @@ -920,10 +915,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( } // Finish the archive. vars.Objects = ""; - for (std::vector<std::string>::const_iterator i = - archiveFinishCommands.begin(); - i != archiveFinishCommands.end(); ++i) { - std::string cmd = launcher + *i; + for (std::string const& afc : archiveFinishCommands) { + std::string cmd = launcher + afc; rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, cmd, vars); // If there is no ranlib the command will be ":". Skip it. @@ -939,17 +932,16 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY)) { std::string cmakeCommand = this->LocalGenerator->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); - cmakeCommand += " -E __run_iwyu --lwyu="; + cmakeCommand += " -E __run_co_compile --lwyu="; cmakeCommand += targetOutPathReal; real_link_commands.push_back(cmakeCommand); } // Expand placeholders. - for (std::vector<std::string>::iterator i = real_link_commands.begin(); - i != real_link_commands.end(); ++i) { - *i = launcher + *i; - rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i, - vars); + for (std::string& real_link_command : real_link_commands) { + real_link_command = launcher + real_link_command; + rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, + real_link_command, vars); } } |