summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-11-22 10:00:45 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-01-11 16:00:55 (GMT)
commit238dd2fbab1bd4fb53a25dcd07c1ee41da46d451 (patch)
tree2ad1d3c2057e6d568fb55da0a9b872f992cb06d6 /Source
parent2f7ef7e38d7aad93f5d25efb4fd7f61468cf06a2 (diff)
downloadCMake-238dd2fbab1bd4fb53a25dcd07c1ee41da46d451.zip
CMake-238dd2fbab1bd4fb53a25dcd07c1ee41da46d451.tar.gz
CMake-238dd2fbab1bd4fb53a25dcd07c1ee41da46d451.tar.bz2
Use insert instead of a loop in some cases.
Limit this change to inserting into a vector from a vector. A follow up change can use insert for inserting into a set.
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx7
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx7
-rw-r--r--Source/CTest/cmCTestP4.cxx6
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx18
-rw-r--r--Source/cmAddTestCommand.cxx6
-rw-r--r--Source/cmConditionEvaluator.cxx10
-rw-r--r--Source/cmCustomCommand.cxx13
-rw-r--r--Source/cmFindBase.cxx6
-rw-r--r--Source/cmFunctionCommand.cxx6
-rw-r--r--Source/cmGeneratorTarget.cxx6
-rw-r--r--Source/cmInstallFilesCommand.cxx7
-rw-r--r--Source/cmInstallProgramsCommand.cxx6
-rw-r--r--Source/cmLocalGenerator.cxx12
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx9
-rw-r--r--Source/cmMacroCommand.cxx6
-rw-r--r--Source/cmMakefile.cxx7
-rw-r--r--Source/cmMakefileTargetGenerator.cxx36
-rw-r--r--Source/cmQtAutoGenerators.cxx31
-rw-r--r--Source/cmRemoveCommand.cxx5
-rw-r--r--Source/cmSystemTools.cxx6
-rw-r--r--Source/cmTarget.cxx7
21 files changed, 48 insertions, 169 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index d226a6c..5e7d764 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -1094,11 +1094,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
{
// Create a contiguous array for the line
this->CurrentProcessingLine.clear();
- t_BuildProcessingQueueType::iterator cit;
- for ( cit = queue->begin(); cit != it; ++cit )
- {
- this->CurrentProcessingLine.push_back(*cit);
- }
+ this->CurrentProcessingLine.insert(this->CurrentProcessingLine.end(),
+ queue->begin(), queue->end());
this->CurrentProcessingLine.push_back(0);
const char* line = &*this->CurrentProcessingLine.begin();
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 4c89caa..97637ed 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -526,11 +526,8 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
TestList sortedCopy;
- for(TestSet::const_iterator j = currentSet.begin();
- j != currentSet.end(); ++j)
- {
- sortedCopy.push_back(*j);
- }
+ sortedCopy.insert(sortedCopy.end(),
+ currentSet.begin(), currentSet.end());
std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp);
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 0bb1a99..52b98d7 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -349,11 +349,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions)
std::vector<std::string> args =
cmSystemTools::ParseArguments(opts.c_str());
- for(std::vector<std::string>::const_iterator ai = args.begin();
- ai != args.end(); ++ai)
- {
- P4Options.push_back(*ai);
- }
+ P4Options.insert(P4Options.end(), args.begin(), args.end());
}
CommandOptions.clear();
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 07a994d..4aa8d04 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -74,13 +74,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
std::vector<std::string> notesFiles;
cmCTest::VectorOfStrings newNotesFiles;
cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles);
- std::vector<std::string>::iterator it;
- for ( it = notesFiles.begin();
- it != notesFiles.end();
- ++ it )
- {
- newNotesFiles.push_back(*it);
- }
+ newNotesFiles.insert(newNotesFiles.end(),
+ notesFiles.begin(), notesFiles.end());
this->CTest->GenerateNotesFile(newNotesFiles);
}
@@ -91,13 +86,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
std::vector<std::string> extraFiles;
cmCTest::VectorOfStrings newExtraFiles;
cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles);
- std::vector<std::string>::iterator it;
- for ( it = extraFiles.begin();
- it != extraFiles.end();
- ++ it )
- {
- newExtraFiles.push_back(*it);
- }
+ newExtraFiles.insert(newExtraFiles.end(),
+ extraFiles.begin(), extraFiles.end());
if ( !this->CTest->SubmitExtraFiles(newExtraFiles))
{
this->SetError("problem submitting extra files.");
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 2531a1a..dc3b4c2 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -36,11 +36,7 @@ bool cmAddTestCommand
// Collect the command with arguments.
std::vector<std::string> command;
- for(std::vector<std::string>::const_iterator it = args.begin() + 1;
- it != args.end(); ++it)
- {
- command.push_back(*it);
- }
+ command.insert(command.end(), args.begin() + 1, args.end());
// Create the test but add a generator only the first time it is
// seen. This preserves behavior from before test generators.
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index aba26de..7a601e2 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -53,10 +53,7 @@ bool cmConditionEvaluator::IsTrue(
cmArgumentList newArgs;
// copy to the list structure
- for(unsigned int i = 0; i < args.size(); ++i)
- {
- newArgs.push_back(args[i]);
- }
+ newArgs.insert(newArgs.end(), args.begin(), args.end());
// now loop through the arguments and see if we can reduce any of them
// we do this multiple times. Once for each level of precedence
@@ -411,10 +408,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList &newArgs,
// copy to the list structure
cmArgumentList::iterator argP1 = arg;
argP1++;
- for(; argP1 != argClose; argP1++)
- {
- newArgs2.push_back(*argP1);
- }
+ newArgs2.insert(newArgs2.end(), argP1, argClose);
newArgs2.pop_back();
// now recursively invoke IsTrue to handle the values inside the
// parenthetical expression
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 2afb029..015825d 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -131,21 +131,14 @@ const char* cmCustomCommand::GetComment() const
//----------------------------------------------------------------------------
void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
{
- for(cmCustomCommandLines::const_iterator i=commandLines.begin();
- i != commandLines.end(); ++i)
- {
- this->CommandLines.push_back(*i);
- }
+ this->CommandLines.insert(this->CommandLines.end(),
+ commandLines.begin(), commandLines.end());
}
//----------------------------------------------------------------------------
void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
{
- for(std::vector<std::string>::const_iterator i=depends.begin();
- i != depends.end(); ++i)
- {
- this->Depends.push_back(*i);
- }
+ this->Depends.insert(this->Depends.end(), depends.begin(), depends.end());
}
//----------------------------------------------------------------------------
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index beb6dde..013724e 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -184,10 +184,8 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
std::vector<std::string> shortArgs = this->Names;
this->Names.clear(); // clear out any values in Names
this->Names.push_back(shortArgs[0]);
- for(unsigned int j = 1; j < shortArgs.size(); ++j)
- {
- this->UserGuessArgs.push_back(shortArgs[j]);
- }
+ this->UserGuessArgs.insert(this->UserGuessArgs.end(),
+ shortArgs.begin() + 1, shortArgs.end());
}
this->ExpandPaths();
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 3580374..488538f 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -271,11 +271,7 @@ bool cmFunctionCommand
// create a function blocker
cmFunctionFunctionBlocker *f = new cmFunctionFunctionBlocker();
- for(std::vector<std::string>::const_iterator j = args.begin();
- j != args.end(); ++j)
- {
- f->Args.push_back(*j);
- }
+ f->Args.insert(f->Args.end(), args.begin(), args.end());
this->Makefile->AddFunctionBlocker(f);
return true;
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 2b531e2..435452c 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -489,11 +489,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
unique.insert(*li);
}
result.clear();
- for(std::set<std::string>::iterator li = unique.begin();
- li != unique.end(); ++li)
- {
- result.push_back(*li);
- }
+ result.insert(result.end(), unique.begin(), unique.end());
IncludeCacheType::value_type entry(config_upper, result);
iter = this->SystemIncludesCache.insert(entry).first;
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index f106e1a..a007693 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -47,11 +47,8 @@ bool cmInstallFilesCommand
else
{
this->IsFilesForm = false;
- std::vector<std::string>::const_iterator s = args.begin();
- for (++s;s != args.end(); ++s)
- {
- this->FinalArgs.push_back(*s);
- }
+ this->FinalArgs.insert(this->FinalArgs.end(),
+ args.begin() + 1, args.end());
}
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 0405769..cc223ab 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -27,11 +27,7 @@ bool cmInstallProgramsCommand
this->Destination = args[0];
- std::vector<std::string>::const_iterator s = args.begin();
- for (++s;s != args.end(); ++s)
- {
- this->FinalArgs.push_back(*s);
- }
+ this->FinalArgs.insert(this->FinalArgs.end(), args.begin() + 1, args.end());
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
->AddInstallComponent(this->Makefile->GetSafeDefinition(
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2de6c93..a4185ad 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -634,11 +634,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
// Parse the string to get the custom command line.
cmCustomCommandLine commandLine;
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
- for(std::vector<std::string>::iterator a = cmd.begin();
- a != cmd.end(); ++a)
- {
- commandLine.push_back(*a);
- }
+ commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
// Store this command line.
commandLines.push_back(commandLine);
@@ -745,11 +741,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
// Parse the string to get the custom command line.
cmCustomCommandLine commandLine;
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
- for(std::vector<std::string>::iterator a = cmd.begin();
- a != cmd.end(); ++a)
- {
- commandLine.push_back(*a);
- }
+ commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
// Store this command line.
commandLines.push_back(commandLine);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 812ded3..96beb1c 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1856,13 +1856,8 @@ void cmLocalUnixMakefileGenerator3
{
text = "Running external command ...";
}
- std::set<std::string>::const_iterator dit;
- for ( dit = glIt->second.GetUtilities().begin();
- dit != glIt->second.GetUtilities().end();
- ++ dit )
- {
- depends.push_back(*dit);
- }
+ depends.insert(depends.end(), glIt->second.GetUtilities().begin(),
+ glIt->second.GetUtilities().end());
this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal);
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index ae81c58..d399313 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -328,11 +328,7 @@ bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
// create a function blocker
cmMacroFunctionBlocker *f = new cmMacroFunctionBlocker();
- for(std::vector<std::string>::const_iterator j = args.begin();
- j != args.end(); ++j)
- {
- f->Args.push_back(*j);
- }
+ f->Args.insert(f->Args.end(), args.begin(), args.end());
this->Makefile->AddFunctionBlocker(f);
return true;
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 20dae5a..25d5881 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2567,12 +2567,7 @@ std::vector<std::string> cmMakefile
}
std::vector<std::string> res;
-
- std::set<std::string>::iterator fit;
- for ( fit = definitions.begin(); fit != definitions.end(); fit ++ )
- {
- res.push_back(*fit);
- }
+ res.insert(res.end(), definitions.begin(), definitions.end());
return res;
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index cbf8573..040a7d6 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -759,13 +759,10 @@ cmMakefileTargetGenerator
if(const char* extra_outputs_str =
source.GetProperty("OBJECT_OUTPUTS"))
{
+ // Register these as extra files to clean.
cmSystemTools::ExpandListArgument(extra_outputs_str, outputs);
- for(std::vector<std::string>::const_iterator eoi = outputs.begin()+1;
- eoi != outputs.end(); ++eoi)
- {
- // Register this as an extra file to clean.
- this->CleanFiles.push_back(*eoi);
- }
+ this->CleanFiles.insert(this->CleanFiles.end(),
+ outputs.begin() + 1, outputs.end());
}
// Write the rule.
@@ -1174,11 +1171,7 @@ cmMakefileTargetGenerator
{
cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile);
const std::vector<std::string>& outputs = ccg.GetOutputs();
- for(std::vector<std::string>::const_iterator o = outputs.begin();
- o != outputs.end(); ++o)
- {
- depends.push_back(*o);
- }
+ depends.insert(depends.end(), outputs.begin(), outputs.end());
}
}
}
@@ -1462,11 +1455,8 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
}
// Make sure the extra files are built.
- for(std::set<std::string>::const_iterator i = this->ExtraFiles.begin();
- i != this->ExtraFiles.end(); ++i)
- {
- depends.push_back(*i);
- }
+ depends.insert(depends.end(),
+ this->ExtraFiles.begin(), this->ExtraFiles.end());
}
// Write the driver rule.
@@ -1553,11 +1543,7 @@ void cmMakefileTargetGenerator
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
{
std::vector<std::string> const& libDeps = cli->GetDepends();
- for(std::vector<std::string>::const_iterator j = libDeps.begin();
- j != libDeps.end(); ++j)
- {
- depends.push_back(*j);
- }
+ depends.insert(depends.end(), libDeps.begin(), libDeps.end());
}
}
@@ -1577,12 +1563,8 @@ void cmMakefileTargetGenerator
}
// Add dependencies on the external object files.
- for(std::vector<std::string>::const_iterator obj
- = this->ExternalObjects.begin();
- obj != this->ExternalObjects.end(); ++obj)
- {
- depends.push_back(*obj);
- }
+ depends.insert(depends.end(),
+ this->ExternalObjects.begin(), this->ExternalObjects.end());
// Add a dependency on the rule file itself.
this->LocalGenerator->AppendRuleDepend(depends,
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index a01a384..443162a 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -2188,24 +2188,12 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
std::vector<std::string> command;
command.push_back(this->MocExecutable);
- for (std::list<std::string>::const_iterator it = this->MocIncludes.begin();
- it != this->MocIncludes.end();
- ++it)
- {
- command.push_back(*it);
- }
- for(std::list<std::string>::const_iterator it=this->MocDefinitions.begin();
- it != this->MocDefinitions.end();
- ++it)
- {
- command.push_back(*it);
- }
- for(std::vector<std::string>::const_iterator it=this->MocOptions.begin();
- it != this->MocOptions.end();
- ++it)
- {
- command.push_back(*it);
- }
+ command.insert(command.end(),
+ this->MocIncludes.begin(), this->MocIncludes.end());
+ command.insert(command.end(),
+ this->MocDefinitions.begin(), this->MocDefinitions.end());
+ command.insert(command.end(),
+ this->MocOptions.begin(), this->MocOptions.end());
#ifdef _WIN32
command.push_back("-DWIN32");
#endif
@@ -2277,12 +2265,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
cmSystemTools::ExpandListArgument(optionIt->second, fileOpts);
this->MergeUicOptions(opts, fileOpts, this->QtMajorVersion == "5");
}
- for(std::vector<std::string>::const_iterator optIt = opts.begin();
- optIt != opts.end();
- ++optIt)
- {
- command.push_back(*optIt);
- }
+ command.insert(command.end(), opts.begin(), opts.end());
command.push_back("-o");
command.push_back(this->Builddir + ui_output_file);
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index bcb8564..d8aa1cb 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -39,10 +39,7 @@ bool cmRemoveCommand
// check for REMOVE(VAR v1 v2 ... vn)
std::vector<std::string> argsExpanded;
std::vector<std::string> temp;
- for(unsigned int j = 1; j < args.size(); ++j)
- {
- temp.push_back(args[j]);
- }
+ temp.insert(temp.end(), args.begin() + 1, args.end());
cmSystemTools::ExpandList(temp, argsExpanded);
// now create the new value
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1c8c387..54dafd2 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1273,11 +1273,7 @@ bool cmSystemTools::Split(const char* s, std::vector<std::string>& l)
{
std::vector<std::string> temp;
bool res = Superclass::Split(s, temp);
- for(std::vector<std::string>::const_iterator i = temp.begin();
- i != temp.end(); ++i)
- {
- l.push_back(*i);
- }
+ l.insert(l.end(), temp.begin(), temp.end());
return res;
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 94a6de3..1b39804 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -6449,11 +6449,8 @@ cmTargetInternals::ComputeLinkImplementationLanguages(
// Get languages used in our source files.
thisTarget->GetLanguages(languages, config);
// Copy the set of langauges to the link implementation.
- for(std::set<std::string>::iterator li = languages.begin();
- li != languages.end(); ++li)
- {
- impl.Languages.push_back(*li);
- }
+ impl.Languages.insert(impl.Languages.begin(),
+ languages.begin(), languages.end());
}
//----------------------------------------------------------------------------