Use cmAppend to append ranges to std::vector instances

This commit is contained in:
Sebastian Holtermann committed 2019-05-23 16:19:49 +02:00
1 parent 999516478d
commit 006229278b
59 files changed
+181 -246

No files matched your search

+2 -1
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestBZR.h"
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmProcessTools.h"
@@ -242,7 +243,7 @@ private:
void CharacterDataHandler(const char* data, int length) override
{
this->CData.insert(this->CData.end(), data, data + length);
cmAppend(this->CData, data, data + length);
}
void EndElement(const std::string& name) override
+1 -2
View File
@@ -978,8 +978,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
if (it != queue->end()) {
// Create a contiguous array for the line
this->CurrentProcessingLine.clear();
this->CurrentProcessingLine.insert(this->CurrentProcessingLine.end(),
queue->begin(), it);
cmAppend(this->CurrentProcessingLine, queue->begin(), it);
this->CurrentProcessingLine.push_back(0);
const char* line = this->CurrentProcessingLine.data();
+6 -10
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestCoverageHandler.h"
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
@@ -813,15 +814,11 @@ int cmCTestCoverageHandler::HandleJacocoCoverage(
// ...and in the binary directory.
cmsys::Glob g2;
std::vector<std::string> binFiles;
g2.SetRecurse(true);
std::string binaryDir = this->CTest->GetCTestConfiguration("BuildDirectory");
std::string binCoverageFile = binaryDir + "/*jacoco.xml";
g2.FindFiles(binCoverageFile);
binFiles = g2.GetFiles();
if (!binFiles.empty()) {
files.insert(files.end(), binFiles.begin(), binFiles.end());
}
cmAppend(files, g2.GetFiles());
if (!files.empty()) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
@@ -1465,8 +1462,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
" looking for LCOV files in: " << daGlob << std::endl, this->Quiet);
gl.FindFiles(daGlob);
// Keep a list of all LCOV files
lcovFiles.insert(lcovFiles.end(), gl.GetFiles().begin(),
gl.GetFiles().end());
cmAppend(lcovFiles, gl.GetFiles());
for (std::string const& file : lcovFiles) {
lcovFile = file;
@@ -1604,11 +1600,11 @@ void cmCTestCoverageHandler::FindGCovFiles(std::vector<std::string>& files)
std::string daGlob = lm.first;
daGlob += "/*.da";
gl.FindFiles(daGlob);
files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end());
cmAppend(files, gl.GetFiles());
daGlob = lm.first;
daGlob += "/*.gcda";
gl.FindFiles(daGlob);
files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end());
cmAppend(files, gl.GetFiles());
}
}
@@ -1645,7 +1641,7 @@ bool cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files)
"Error while finding files matching " << daGlob << std::endl);
return false;
}
files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end());
cmAppend(files, gl.GetFiles());
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Now searching in: " << daGlob << std::endl, this->Quiet);
return true;
+3 -6
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestCurl.h"
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCurl.h"
#include "cmSystemTools.h"
@@ -43,19 +44,15 @@ size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
void* data)
{
int realsize = static_cast<int>(size * nmemb);
std::vector<char>* vec = static_cast<std::vector<char>*>(data);
const char* chPtr = static_cast<char*>(ptr);
vec->insert(vec->end(), chPtr, chPtr + realsize);
cmAppend(*static_cast<std::vector<char>*>(data), chPtr, chPtr + realsize);
return realsize;
}
size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/,
char* chPtr, size_t size, void* data)
{
std::vector<char>* vec = static_cast<std::vector<char>*>(data);
vec->insert(vec->end(), chPtr, chPtr + size);
cmAppend(*static_cast<std::vector<char>*>(data), chPtr, chPtr + size);
return size;
}
}
+2 -1
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestHG.h"
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmProcessTools.h"
@@ -202,7 +203,7 @@ private:
void CharacterDataHandler(const char* data, int length) override
{
this->CData.insert(this->CData.end(), data, data + length);
cmAppend(this->CData, data, data + length);
}
void EndElement(const std::string& name) override
+7 -9
View File
@@ -3,6 +3,7 @@
#include "cmCTestMultiProcessHandler.h"
#include "cmAffinity.h"
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestRunTest.h"
#include "cmCTestTestHandler.h"
@@ -653,13 +654,10 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
// Reverse iterate over the different dependency levels (deepest first).
// Sort tests within each level by COST and append them to the cost list.
for (TestSet const& currentSet : cmReverseRange(priorityStack)) {
TestComparator comp(this);
TestList sortedCopy;
sortedCopy.insert(sortedCopy.end(), currentSet.begin(), currentSet.end());
std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp);
cmAppend(sortedCopy, currentSet);
std::stable_sort(sortedCopy.begin(), sortedCopy.end(),
TestComparator(this));
for (auto const& j : sortedCopy) {
if (alreadySortedTests.find(j) == alreadySortedTests.end()) {
@@ -688,8 +686,8 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList()
presortedList.push_back(i.first);
}
TestComparator comp(this);
std::stable_sort(presortedList.begin(), presortedList.end(), comp);
std::stable_sort(presortedList.begin(), presortedList.end(),
TestComparator(this));
TestSet alreadySortedTests;
@@ -992,7 +990,7 @@ static Json::Value DumpCTestInfo(
const std::vector<std::string>& args = testRun.GetArguments();
if (!args.empty()) {
commandAndArgs.reserve(args.size() + 1);
commandAndArgs.insert(commandAndArgs.end(), args.begin(), args.end());
cmAppend(commandAndArgs, args);
}
testInfo["command"] = DumpToJsonArray(commandAndArgs);
}
+2 -3
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestP4.h"
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmProcessTools.h"
@@ -324,9 +325,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*>& CommandOptions)
// The CTEST_P4_OPTIONS variable adds additional Perforce command line
// options before the main command
std::string opts = this->CTest->GetCTestConfiguration("P4Options");
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
P4Options.insert(P4Options.end(), args.begin(), args.end());
cmAppend(P4Options, cmSystemTools::ParseArguments(opts));
}
CommandOptions.clear();
+3 -4
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestSVN.h"
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmProcessTools.h"
@@ -269,9 +270,7 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
std::vector<char const*> args;
args.push_back(this->CommandLineTool.c_str());
args.insert(args.end(), parameters.begin(), parameters.end());
cmAppend(args, parameters);
args.push_back("--non-interactive");
std::string userOptions = this->CTest->GetCTestConfiguration("SVNOptions");
@@ -344,7 +343,7 @@ private:
void CharacterDataHandler(const char* data, int length) override
{
this->CData.insert(this->CData.end(), data, data + length);
cmAppend(this->CData, data, data + length);
}
void EndElement(const std::string& name) override
+7 -14
View File
@@ -63,7 +63,7 @@ private:
void CharacterDataHandler(const char* data, int length) override
{
this->CurrentValue.insert(this->CurrentValue.end(), data, data + length);
cmAppend(this->CurrentValue, data, data + length);
}
void EndElement(const std::string& name) override
@@ -93,12 +93,9 @@ static size_t cmCTestSubmitHandlerWriteMemoryCallback(void* ptr, size_t size,
size_t nmemb, void* data)
{
int realsize = static_cast<int>(size * nmemb);
cmCTestSubmitHandlerVectorOfChar* vec =
static_cast<cmCTestSubmitHandlerVectorOfChar*>(data);
const char* chPtr = static_cast<char*>(ptr);
vec->insert(vec->end(), chPtr, chPtr + realsize);
cmAppend(*static_cast<cmCTestSubmitHandlerVectorOfChar*>(data), chPtr,
chPtr + realsize);
return realsize;
}
@@ -107,10 +104,8 @@ static size_t cmCTestSubmitHandlerCurlDebugCallback(CURL* /*unused*/,
char* chPtr, size_t size,
void* data)
{
cmCTestSubmitHandlerVectorOfChar* vec =
static_cast<cmCTestSubmitHandlerVectorOfChar*>(data);
vec->insert(vec->end(), chPtr, chPtr + size);
cmAppend(*static_cast<cmCTestSubmitHandlerVectorOfChar*>(data), chPtr,
chPtr + size);
return size;
}
@@ -769,8 +764,7 @@ int cmCTestSubmitHandler::ProcessHandler()
if (!this->Files.empty()) {
// Submit the explicitly selected files:
//
files.insert(files.end(), this->Files.begin(), this->Files.end());
cmAppend(files, this->Files);
}
// Add to the list of files to submit from any selected, existing parts:
@@ -816,8 +810,7 @@ int cmCTestSubmitHandler::ProcessHandler()
}
// Submit files from this part.
std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p);
files.insert(files.end(), pfiles.begin(), pfiles.end());
cmAppend(files, this->CTest->GetSubmitFiles(p));
}
// Make sure files are unique, but preserve order.
+2 -1
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmProcess.h"
#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestRunTest.h"
#include "cmCTestTestHandler.h"
@@ -215,7 +216,7 @@ void cmProcess::OnRead(ssize_t nread, const uv_buf_t* buf)
if (nread > 0) {
std::string strdata;
this->Conv.DecodeText(buf->base, static_cast<size_t>(nread), strdata);
this->Output.insert(this->Output.end(), strdata.begin(), strdata.end());
cmAppend(this->Output, strdata);
while (this->Output.GetLine(line)) {
this->Runner.CheckOutput(line);
+2 -1
View File
@@ -4,6 +4,7 @@
#include <sstream>
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -338,7 +339,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
return true;
}
srclists.insert(srclists.end(), s, args.end());
cmAppend(srclists, s, args.end());
this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll);
+1 -2
View File
@@ -27,8 +27,7 @@ bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args,
}
// Collect the command with arguments.
std::vector<std::string> command;
command.insert(command.end(), args.begin() + 1, args.end());
std::vector<std::string> command(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.
+4 -5
View File
@@ -1282,7 +1282,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
while (cmsysProcess_WaitForData(cp, &data, &length, nullptr)) {
processOutput.DecodeText(data, length, strdata);
if (output) {
tempOutput.insert(tempOutput.end(), data, data + length);
cmAppend(tempOutput, data, data + length);
}
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
cmCTestLogWrite(strdata.c_str(), strdata.size()));
@@ -2194,8 +2194,7 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
bool SRArgumentSpecified = false;
// copy the command line
this->Impl->InitialCommandLineArguments.insert(
this->Impl->InitialCommandLineArguments.end(), args.begin(), args.end());
cmAppend(this->Impl->InitialCommandLineArguments, args);
// process the command line arguments
for (size_t i = 1; i < args.size(); ++i) {
@@ -2958,10 +2957,10 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args,
res = cmsysProcess_WaitForData(cp, &data, &length, nullptr);
switch (res) {
case cmsysProcess_Pipe_STDOUT:
tempOutput.insert(tempOutput.end(), data, data + length);
cmAppend(tempOutput, data, data + length);
break;
case cmsysProcess_Pipe_STDERR:
tempError.insert(tempError.end(), data, data + length);
cmAppend(tempError, data, data + length);
break;
default:
done = true;
+2 -5
View File
@@ -94,10 +94,7 @@ bool cmConditionEvaluator::IsTrue(
}
// store the reduced args in this vector
cmArgumentList newArgs;
// copy to the list structure
newArgs.insert(newArgs.end(), args.begin(), args.end());
cmArgumentList newArgs(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
@@ -398,7 +395,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs,
// copy to the list structure
cmArgumentList::iterator argP1 = arg;
argP1++;
newArgs2.insert(newArgs2.end(), argP1, argClose);
cmAppend(newArgs2, argP1, argClose);
newArgs2.pop_back();
// now recursively invoke IsTrue to handle the values inside the
// parenthetical expression
+4 -5
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCustomCommand.h"
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include <utility>
@@ -54,13 +55,12 @@ const char* cmCustomCommand::GetComment() const
void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
{
this->CommandLines.insert(this->CommandLines.end(), commandLines.begin(),
commandLines.end());
cmAppend(this->CommandLines, commandLines);
}
void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
{
this->Depends.insert(this->Depends.end(), depends.begin(), depends.end());
cmAppend(this->Depends, depends);
}
bool cmCustomCommand::GetEscapeOldStyle() const
@@ -101,8 +101,7 @@ void cmCustomCommand::SetImplicitDepends(ImplicitDependsList const& l)
void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList const& l)
{
this->ImplicitDepends.insert(this->ImplicitDepends.end(), l.begin(),
l.end());
cmAppend(this->ImplicitDepends, l);
}
bool cmCustomCommand::GetUsesTerminal() const
+5 -7
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCustomCommandGenerator.h"
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmGeneratorExpression.h"
@@ -33,9 +34,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
this->GE->Parse(clarg);
std::string parsed_arg = cge->Evaluate(this->LG, this->Config);
if (this->CC.GetCommandExpandLists()) {
std::vector<std::string> ExpandedArg;
cmSystemTools::ExpandListArgument(parsed_arg, ExpandedArg);
argv.insert(argv.end(), ExpandedArg.begin(), ExpandedArg.end());
cmAppend(argv, cmSystemTools::ExpandedListArgument(parsed_arg));
} else {
argv.push_back(std::move(parsed_arg));
}
@@ -54,15 +53,14 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
std::vector<std::string> depends = this->CC.GetDepends();
for (std::string const& d : depends) {
std::unique_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(d);
std::vector<std::string> result;
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config),
result);
std::vector<std::string> result = cmSystemTools::ExpandedListArgument(
cge->Evaluate(this->LG, this->Config));
for (std::string& it : result) {
if (cmSystemTools::FileIsFullPath(it)) {
it = cmSystemTools::CollapseFullPath(it);
}
}
this->Depends.insert(this->Depends.end(), result.begin(), result.end());
cmAppend(this->Depends, result);
}
const std::string& workingdirectory = this->CC.GetWorkingDirectory();
+2 -1
View File
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include <string>
@@ -46,7 +47,7 @@ public:
}
void Append(const std::vector<cmDocumentationEntry>& entries)
{
this->Entries.insert(this->Entries.end(), entries.begin(), entries.end());
cmAppend(this->Entries, entries);
}
/** Append an entry to this section using NULL terminated chars */
+2 -1
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmELF.h"
#include "cmAlgorithms.h"
#include "cm_kwiml.h"
#include "cmsys/FStream.hxx"
#include <map>
@@ -572,7 +573,7 @@ std::vector<char> cmELFInternalImpl<Types>::EncodeDynamicEntries(
}
char* pdyn = reinterpret_cast<char*>(&dyn);
result.insert(result.end(), pdyn, pdyn + sizeof(ELF_Dyn));
cmAppend(result, pdyn, pdyn + sizeof(ELF_Dyn));
}
return result;
+1 -1
View File
@@ -393,5 +393,5 @@ void cmExecuteProcessCommandAppend(std::vector<char>& output, const char* data,
--length;
}
#endif
output.insert(output.end(), data, data + length);
cmAppend(output, data, data + length);
}
+2 -1
View File
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmAlgorithms.h"
#include "cmExportFileGenerator.h"
#include "cmStateTypes.h"
@@ -39,7 +40,7 @@ public:
void GetTargets(std::vector<std::string>& targets) const;
void AppendTargets(std::vector<std::string> const& targets)
{
this->Targets.insert(this->Targets.end(), targets.begin(), targets.end());
cmAppend(this->Targets, targets);
}
void SetExportSet(cmExportSet*);
+10 -15
View File
@@ -209,9 +209,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
// Collect all files
std::vector<std::string> listFiles;
for (cmLocalGenerator* lg : it.second) {
const std::vector<std::string>& files =
lg->GetMakefile()->GetListFiles();
listFiles.insert(listFiles.end(), files.begin(), files.end());
cmAppend(listFiles, lg->GetMakefile()->GetListFiles());
}
// Convert
@@ -563,27 +561,24 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
// the include directories for this target
std::vector<std::string> allIncludeDirs;
std::vector<std::string> includes;
lg->GetIncludeDirectories(includes, target, "C", buildType);
allIncludeDirs.insert(allIncludeDirs.end(), includes.begin(),
includes.end());
{
std::vector<std::string> includes;
lg->GetIncludeDirectories(includes, target, "C", buildType);
cmAppend(allIncludeDirs, includes);
}
std::string systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty()) {
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
allIncludeDirs.insert(allIncludeDirs.end(), dirs.begin(), dirs.end());
cmAppend(allIncludeDirs,
cmSystemTools::ExpandedListArgument(systemIncludeDirs));
}
systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty()) {
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
allIncludeDirs.insert(allIncludeDirs.end(), dirs.begin(), dirs.end());
cmAppend(allIncludeDirs,
cmSystemTools::ExpandedListArgument(systemIncludeDirs));
}
std::vector<std::string>::const_iterator end =
+2 -2
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFileAPICodemodel.h"
#include "cmAlgorithms.h"
#include "cmCryptoHash.h"
#include "cmFileAPI.h"
#include "cmGeneratorExpression.h"
@@ -477,8 +478,7 @@ Json::Value CodemodelConfig::DumpTargets()
cmGlobalGenerator* gg =
this->FileAPI.GetCMakeInstance()->GetGlobalGenerator();
for (cmLocalGenerator const* lg : gg->GetLocalGenerators()) {
std::vector<cmGeneratorTarget*> const& list = lg->GetGeneratorTargets();
targetList.insert(targetList.end(), list.begin(), list.end());
cmAppend(targetList, lg->GetGeneratorTargets());
}
std::sort(targetList.begin(), targetList.end(),
[](cmGeneratorTarget* l, cmGeneratorTarget* r) {
+7 -8
View File
@@ -890,7 +890,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
}
std::vector<std::string>& foundFiles = g.GetFiles();
files.insert(files.end(), foundFiles.begin(), foundFiles.end());
cmAppend(files, foundFiles);
if (configureDepends) {
std::sort(foundFiles.begin(), foundFiles.end());
@@ -1476,23 +1476,22 @@ size_t cmWriteToMemoryCallback(void* ptr, size_t size, size_t nmemb,
void* data)
{
int realsize = static_cast<int>(size * nmemb);
cmFileCommandVectorOfChar* vec =
static_cast<cmFileCommandVectorOfChar*>(data);
const char* chPtr = static_cast<char*>(ptr);
vec->insert(vec->end(), chPtr, chPtr + realsize);
cmAppend(*static_cast<cmFileCommandVectorOfChar*>(data), chPtr,
chPtr + realsize);
return realsize;
}
size_t cmFileCommandCurlDebugCallback(CURL*, curl_infotype type, char* chPtr,
size_t size, void* data)
{
cmFileCommandVectorOfChar* vec =
static_cast<cmFileCommandVectorOfChar*>(data);
cmFileCommandVectorOfChar& vec =
*static_cast<cmFileCommandVectorOfChar*>(data);
switch (type) {
case CURLINFO_TEXT:
case CURLINFO_HEADER_IN:
case CURLINFO_HEADER_OUT:
vec->insert(vec->end(), chPtr, chPtr + size);
cmAppend(vec, chPtr, chPtr + size);
break;
case CURLINFO_DATA_IN:
case CURLINFO_DATA_OUT:
@@ -1502,7 +1501,7 @@ size_t cmFileCommandCurlDebugCallback(CURL*, curl_infotype type, char* chPtr,
int n = sprintf(buf, "[%" KWIML_INT_PRIu64 " bytes data]\n",
static_cast<KWIML_INT_uint64_t>(size));
if (n > 0) {
vec->insert(vec->end(), buf, buf + n);
cmAppend(vec, buf, buf + n);
}
} break;
default:
+1 -2
View File
@@ -146,8 +146,7 @@ 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]);
this->UserGuessArgs.insert(this->UserGuessArgs.end(),
shortArgs.begin() + 1, shortArgs.end());
cmAppend(this->UserGuessArgs, shortArgs.begin() + 1, shortArgs.end());
}
this->ExpandPaths();
+2 -1
View File
@@ -6,6 +6,7 @@
#include <string.h>
#include <utility>
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
@@ -221,7 +222,7 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
// If searching both rooted and unrooted paths add the original
// paths again.
if (this->FindRootPathMode == RootPathModeBoth) {
paths.insert(paths.end(), unrootedPaths.begin(), unrootedPaths.end());
cmAppend(paths, unrootedPaths);
}
}
+1 -1
View File
@@ -177,7 +177,7 @@ bool cmFunctionCommand::InitialPass(std::vector<std::string> const& args,
// create a function blocker
cmFunctionFunctionBlocker* f = new cmFunctionFunctionBlocker();
f->Args.insert(f->Args.end(), args.begin(), args.end());
cmAppend(f->Args, args);
this->Makefile->AddFunctionBlocker(f);
return true;
}
+3 -2
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionParser.h"
#include "cmAlgorithms.h"
#include "cmGeneratorExpressionEvaluator.h"
#include <assert.h>
@@ -52,9 +53,9 @@ static void extendResult(
textContent->Extend(
static_cast<TextContent*>(contents.front())->GetLength());
delete contents.front();
result.insert(result.end(), contents.begin() + 1, contents.end());
cmAppend(result, contents.begin() + 1, contents.end());
} else {
result.insert(result.end(), contents.begin(), contents.end());
cmAppend(result, contents);
}
}
+1 -1
View File
@@ -67,7 +67,7 @@ struct GeneratedMakeCommand
void Add(std::vector<std::string>::const_iterator start,
std::vector<std::string>::const_iterator end)
{
PrimaryCommand.insert(PrimaryCommand.end(), start, end);
cmAppend(PrimaryCommand, start, end);
}
std::string Printable() const { return cmJoin(PrimaryCommand, " "); }
+1 -2
View File
@@ -66,8 +66,7 @@ cmGlobalJOMMakefileGenerator::GenerateBuildCommand(
// Since we have full control over the invocation of JOM, let us
// make it quiet.
jomMakeOptions.push_back(this->MakeSilentFlag);
jomMakeOptions.insert(jomMakeOptions.end(), makeOptions.begin(),
makeOptions.end());
cmAppend(jomMakeOptions, makeOptions);
// JOM does parallel builds by default, the -j is only needed if a specific
// number is given
+1 -2
View File
@@ -66,8 +66,7 @@ cmGlobalNMakeMakefileGenerator::GenerateBuildCommand(
// Since we have full control over the invocation of nmake, let us
// make it quiet.
nmakeMakeOptions.push_back(this->MakeSilentFlag);
nmakeMakeOptions.insert(nmakeMakeOptions.end(), makeOptions.begin(),
makeOptions.end());
cmAppend(nmakeMakeOptions, makeOptions);
return this->cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
makeProgram, projectName, projectDir, targetNames, config, fast,
+2 -3
View File
@@ -1016,7 +1016,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
this->AppendTargetOutputs(targetDep, outs, depends);
}
std::sort(outs.begin(), outs.end());
outputs.insert(outputs.end(), outs.begin(), outs.end());
cmAppend(outputs, outs);
}
}
@@ -1025,8 +1025,7 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure(
{
cmNinjaOuts outs;
this->AppendTargetDependsClosure(target, outs, true);
outputs.insert(outputs.end(), outs.begin(), outs.end());
cmAppend(outputs, outs);
}
void cmGlobalNinjaGenerator::AppendTargetDependsClosure(
+1 -4
View File
@@ -282,11 +282,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// for each cmMakefile get its list of dependencies
std::vector<std::string> lfiles;
for (cmLocalGenerator* localGen : this->LocalGenerators) {
lg = static_cast<cmLocalUnixMakefileGenerator3*>(localGen);
// Get the list of files contributing to this generation step.
lfiles.insert(lfiles.end(), lg->GetMakefile()->GetListFiles().begin(),
lg->GetMakefile()->GetListFiles().end());
cmAppend(lfiles, localGen->GetMakefile()->GetListFiles());
}
cmake* cm = this->GetCMakeInstance();
+2 -4
View File
@@ -141,10 +141,8 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
// Collect the input files used to generate all targets in this
// project.
std::vector<std::string> listFiles;
for (unsigned int j = 0; j < generators.size(); ++j) {
cmMakefile* lmf = generators[j]->GetMakefile();
listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(),
lmf->GetListFiles().end());
for (cmLocalGenerator* gen : generators) {
cmAppend(listFiles, gen->GetMakefile()->GetListFiles());
}
// Add a custom prebuild target to run the VerifyGlobs script.
+1 -2
View File
@@ -583,8 +583,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
{
std::vector<std::string> lfiles;
for (auto gen : gens) {
std::vector<std::string> const& lf = gen->GetMakefile()->GetListFiles();
lfiles.insert(lfiles.end(), lf.begin(), lf.end());
cmAppend(lfiles, gen->GetMakefile()->GetListFiles());
}
// sort the array
+3 -3
View File
@@ -6,6 +6,7 @@
#include <iterator>
#include <string.h>
#include "cmAlgorithms.h"
#include "cmIDEFlagTable.h"
#include "cmSystemTools.h"
@@ -170,7 +171,7 @@ void cmIDEOptions::AddDefines(std::string const& defines)
}
void cmIDEOptions::AddDefines(const std::vector<std::string>& defines)
{
this->Defines.insert(this->Defines.end(), defines.begin(), defines.end());
cmAppend(this->Defines, defines);
}
std::vector<std::string> const& cmIDEOptions::GetDefines() const
@@ -192,8 +193,7 @@ void cmIDEOptions::AddIncludes(std::string const& includes)
}
void cmIDEOptions::AddIncludes(const std::vector<std::string>& includes)
{
this->Includes.insert(this->Includes.end(), includes.begin(),
includes.end());
cmAppend(this->Includes, includes);
}
std::vector<std::string> const& cmIDEOptions::GetIncludes() const
+3 -4
View File
@@ -6,6 +6,7 @@
#include <set>
#include <utility>
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
@@ -52,11 +53,9 @@ bool cmIncludeDirectoryCommand::InitialPass(
this->GetIncludes(*i, includes);
if (before) {
beforeIncludes.insert(beforeIncludes.end(), includes.begin(),
includes.end());
cmAppend(beforeIncludes, includes);
} else {
afterIncludes.insert(afterIncludes.end(), includes.begin(),
includes.end());
cmAppend(afterIncludes, includes);
}
if (system) {
systemIncludes.insert(includes.begin(), includes.end());
+2 -2
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallFilesCommand.h"
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
@@ -35,8 +36,7 @@ bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
this->CreateInstallGenerator();
} else {
this->IsFilesForm = false;
this->FinalArgs.insert(this->FinalArgs.end(), args.begin() + 1,
args.end());
cmAppend(this->FinalArgs, args.begin() + 1, args.end());
}
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
+2 -1
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallProgramsCommand.h"
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
@@ -25,7 +26,7 @@ bool cmInstallProgramsCommand::InitialPass(
this->Destination = args[0];
this->FinalArgs.insert(this->FinalArgs.end(), args.begin() + 1, args.end());
cmAppend(this->FinalArgs, args.begin() + 1, args.end());
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
+2 -2
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmJsonObjects.h" // IWYU pragma: keep
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -601,8 +602,7 @@ static Json::Value DumpTargetsList(
std::vector<cmGeneratorTarget*> targetList;
for (auto const& lgIt : generators) {
const auto& list = lgIt->GetGeneratorTargets();
targetList.insert(targetList.end(), list.begin(), list.end());
cmAppend(targetList, lgIt->GetGeneratorTargets());
}
std::sort(targetList.begin(), targetList.end());
+6 -7
View File
@@ -351,9 +351,8 @@ void cmLocalGenerator::CreateEvaluationFileOutputs(std::string const& config)
void cmLocalGenerator::ProcessEvaluationFiles(
std::vector<std::string>& generatedFiles)
{
std::vector<cmGeneratorExpressionEvaluationFile*> ef =
this->Makefile->GetEvaluationFiles();
for (cmGeneratorExpressionEvaluationFile* geef : ef) {
for (cmGeneratorExpressionEvaluationFile* geef :
this->Makefile->GetEvaluationFiles()) {
geef->Generate(this);
if (cmSystemTools::GetFatalErrorOccured()) {
return;
@@ -372,10 +371,10 @@ void cmLocalGenerator::ProcessEvaluationFiles(
return;
}
generatedFiles.insert(generatedFiles.end(), files.begin(), files.end());
std::vector<std::string>::iterator newIt =
generatedFiles.end() - files.size();
std::inplace_merge(generatedFiles.begin(), newIt, generatedFiles.end());
cmAppend(generatedFiles, files);
std::inplace_merge(generatedFiles.begin(),
generatedFiles.end() - files.size(),
generatedFiles.end());
}
}
+2 -2
View File
@@ -862,7 +862,7 @@ void cmLocalUnixMakefileGenerator3::AppendRuleDepends(
// Add a dependency on the rule file itself unless an option to skip
// it is specifically enabled by the user or project.
if (!this->Makefile->IsOn("CMAKE_SKIP_RULE_DEPENDENCY")) {
depends.insert(depends.end(), ruleFiles.begin(), ruleFiles.end());
cmAppend(depends, ruleFiles);
}
}
@@ -1037,7 +1037,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
this->CreateCDCommand(commands1, dir, relative);
// push back the custom commands
commands.insert(commands.end(), commands1.begin(), commands1.end());
cmAppend(commands, commands1);
}
void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
+1 -1
View File
@@ -212,7 +212,7 @@ bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
// create a function blocker
cmMacroFunctionBlocker* f = new cmMacroFunctionBlocker();
f->Args.insert(f->Args.end(), args.begin(), args.end());
cmAppend(f->Args, args);
this->Makefile->AddFunctionBlocker(f);
return true;
}
+1 -2
View File
@@ -2534,8 +2534,7 @@ const std::string& cmMakefile::GetSafeDefinition(const std::string& name) const
std::vector<std::string> cmMakefile::GetDefinitions() const
{
std::vector<std::string> res = this->StateSnapshot.ClosureKeys();
std::vector<std::string> cacheKeys = this->GetState()->GetCacheEntryKeys();
res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
cmAppend(res, this->GetState()->GetCacheEntryKeys());
std::sort(res.begin(), res.end());
return res;
}
@@ -268,7 +268,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
cmAppend(commands, commands1);
commands1.clear();
// Write the build rule.
@@ -638,7 +638,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
cmAppend(commands, commands1);
commands1.clear();
// Add a rule to create necessary symlinks for the library.
@@ -651,7 +651,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
cmAppend(commands, commands1);
commands1.clear();
}
+4 -4
View File
@@ -399,7 +399,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
cmAppend(commands, commands1);
commands1.clear();
// Compute the list of outputs.
@@ -575,7 +575,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
cmAppend(commands, commands1);
commands1.clear();
}
@@ -915,7 +915,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
cmAppend(commands, commands1);
commands1.clear();
// Add a rule to create necessary symlinks for the library.
@@ -932,7 +932,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
this->LocalGenerator->CreateCDCommand(
commands1, this->Makefile->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), commands1.begin(), commands1.end());
cmAppend(commands, commands1);
commands1.clear();
}
+10 -22
View File
@@ -219,14 +219,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
std::vector<cmCustomCommand> buildEventCommands =
this->GeneratorTarget->GetPreBuildCommands();
buildEventCommands.insert(
buildEventCommands.end(),
this->GeneratorTarget->GetPreLinkCommands().begin(),
this->GeneratorTarget->GetPreLinkCommands().end());
buildEventCommands.insert(
buildEventCommands.end(),
this->GeneratorTarget->GetPostBuildCommands().begin(),
this->GeneratorTarget->GetPostBuildCommands().end());
cmAppend(buildEventCommands, this->GeneratorTarget->GetPreLinkCommands());
cmAppend(buildEventCommands,
this->GeneratorTarget->GetPostBuildCommands());
for (const auto& be : buildEventCommands) {
const std::vector<std::string>& byproducts = be.GetByproducts();
@@ -819,8 +814,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
this->LocalGenerator->CreateCDCommand(
compileCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), compileCommands.begin(),
compileCommands.end());
cmAppend(commands, compileCommands);
}
// Check for extra outputs created by the compilation.
@@ -882,8 +876,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
preprocessCommands,
this->LocalGenerator->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), preprocessCommands.begin(),
preprocessCommands.end());
cmAppend(commands, preprocessCommands);
} else {
std::string cmd = "$(CMAKE_COMMAND) -E cmake_unimplemented_variable ";
cmd += preprocessRuleVar;
@@ -929,8 +922,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
this->LocalGenerator->CreateCDCommand(
assemblyCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
this->LocalGenerator->GetBinaryDirectory());
commands.insert(commands.end(), assemblyCommands.begin(),
assemblyCommands.end());
cmAppend(commands, assemblyCommands);
} else {
std::string cmd = "$(CMAKE_COMMAND) -E cmake_unimplemented_variable ";
cmd += assemblyRuleVar;
@@ -1177,8 +1169,7 @@ void cmMakefileTargetGenerator::DriveCustomCommands(
if (cmCustomCommand* cc = source->GetCustomCommand()) {
cmCustomCommandGenerator ccg(*cc, this->ConfigName,
this->LocalGenerator);
const std::vector<std::string>& outputs = ccg.GetOutputs();
depends.insert(depends.end(), outputs.begin(), outputs.end());
cmAppend(depends, ccg.GetOutputs());
}
}
}
@@ -1402,8 +1393,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
}
// Make sure the extra files are built.
depends.insert(depends.end(), this->ExtraFiles.begin(),
this->ExtraFiles.end());
cmAppend(depends, this->ExtraFiles);
}
// Write the driver rule.
@@ -1425,8 +1415,7 @@ void cmMakefileTargetGenerator::AppendTargetDepends(
const std::string& cfg = this->LocalGenerator->GetConfigName();
if (cmComputeLinkInformation* cli =
this->GeneratorTarget->GetLinkInformation(cfg)) {
std::vector<std::string> const& libDeps = cli->GetDepends();
depends.insert(depends.end(), libDeps.begin(), libDeps.end());
cmAppend(depends, cli->GetDepends());
}
}
@@ -1443,8 +1432,7 @@ void cmMakefileTargetGenerator::AppendObjectDepends(
}
// Add dependencies on the external object files.
depends.insert(depends.end(), this->ExternalObjects.begin(),
this->ExternalObjects.end());
cmAppend(depends, this->ExternalObjects);
// Add a dependency on the rule file itself.
this->LocalGenerator->AppendRuleDepend(depends,
+1 -2
View File
@@ -841,8 +841,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
this->GeneratorTarget, orderOnlyDeps, DependOnTargetOrdering);
// Add order-only dependencies on other files associated with the target.
orderOnlyDeps.insert(orderOnlyDeps.end(), this->ExtraFiles.begin(),
this->ExtraFiles.end());
cmAppend(orderOnlyDeps, this->ExtraFiles);
// Add order-only dependencies on custom command outputs.
for (cmCustomCommand const* cc : this->CustomCommands) {
+2 -4
View File
@@ -329,15 +329,13 @@ void cmOrderDirectories::AddLinkLibrary(std::string const& fullPath)
void cmOrderDirectories::AddUserDirectories(
std::vector<std::string> const& extra)
{
this->UserDirectories.insert(this->UserDirectories.end(), extra.begin(),
extra.end());
cmAppend(this->UserDirectories, extra);
}
void cmOrderDirectories::AddLanguageDirectories(
std::vector<std::string> const& dirs)
{
this->LanguageDirectories.insert(this->LanguageDirectories.end(),
dirs.begin(), dirs.end());
cmAppend(this->LanguageDirectories, dirs);
}
void cmOrderDirectories::SetImplicitDirectories(
+2 -3
View File
@@ -68,7 +68,7 @@ void MergeOptions(std::vector<std::string>& baseOpts,
}
}
// Append options
baseOpts.insert(baseOpts.end(), extraOpts.begin(), extraOpts.end());
cmAppend(baseOpts, extraOpts);
}
// - Class definitions
@@ -347,8 +347,7 @@ bool cmQtAutoGen::RccLister::list(std::string const& qrcFile,
{
std::vector<std::string> cmd;
cmd.emplace_back(this->RccExcutable_);
cmd.insert(cmd.end(), this->ListOptions_.begin(),
this->ListOptions_.end());
cmAppend(cmd, this->ListOptions_);
cmd.emplace_back(cmSystemTools::GetFilenameName(qrcFile));
// Log command
+6 -9
View File
@@ -293,11 +293,10 @@ void cmQtAutoMocUic::JobMocPredefsT::Process()
// Compose command
std::vector<std::string> cmd = MocConst().PredefsCmd;
// Add includes
cmd.insert(cmd.end(), MocConst().Includes.begin(),
MocConst().Includes.end());
cmAppend(cmd, MocConst().Includes);
// Add definitions
for (std::string const& def : MocConst().Definitions) {
cmd.push_back("-D" + def);
cmd.emplace_back("-D" + def);
}
// Execute command
if (!RunProcess(GenT::MOC, result, cmd, reason.get())) {
@@ -1398,8 +1397,7 @@ void cmQtAutoMocUic::JobMocT::Process()
std::vector<std::string> cmd;
cmd.push_back(MocConst().Executable);
// Add options
cmd.insert(cmd.end(), MocConst().AllOptions.begin(),
MocConst().AllOptions.end());
cmAppend(cmd, MocConst().AllOptions);
// Add predefs include
if (!MocConst().PredefsFileAbs.empty()) {
cmd.emplace_back("--include");
@@ -1452,7 +1450,7 @@ void cmQtAutoMocUic::JobUicT::Process()
UicMergeOptions(allOpts, optionIt->second,
(BaseConst().QtVersionMajor == 5));
}
cmd.insert(cmd.end(), allOpts.begin(), allOpts.end());
cmAppend(cmd, allOpts);
}
cmd.emplace_back("-o");
cmd.emplace_back(outputFile);
@@ -1881,9 +1879,8 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
// Sort include directories on demand
if (BaseConst().IncludeProjectDirsBefore) {
// Move strings to temporary list
std::list<std::string> includes;
includes.insert(includes.end(), MocConst().IncludePaths.begin(),
MocConst().IncludePaths.end());
std::list<std::string> includes(MocConst().IncludePaths.begin(),
MocConst().IncludePaths.end());
MocConst_.IncludePaths.clear();
MocConst_.IncludePaths.reserve(includes.size());
// Append project directories only
+1 -1
View File
@@ -431,7 +431,7 @@ bool cmQtAutoRcc::GenerateRcc()
// Compose rcc command
std::vector<std::string> cmd;
cmd.push_back(RccExecutable_);
cmd.insert(cmd.end(), Options_.begin(), Options_.end());
cmAppend(cmd, Options_);
cmd.emplace_back("-o");
cmd.push_back(RccFileOutput_);
cmd.push_back(QrcFile_);
+2 -1
View File
@@ -4,6 +4,7 @@
#include <iterator>
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmTarget.h"
@@ -30,7 +31,7 @@ bool cmSetTargetPropertiesCommand::InitialPass(
this->SetError("called with incorrect number of arguments.");
return false;
}
propertyPairs.insert(propertyPairs.end(), j, args.end());
cmAppend(propertyPairs, j, args.end());
break;
}
numFiles++;
+2 -1
View File
@@ -4,6 +4,7 @@
#include <iterator>
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmTest.h"
@@ -30,7 +31,7 @@ bool cmSetTestsPropertiesCommand::InitialPass(
this->SetError("called with incorrect number of arguments.");
return false;
}
propertyPairs.insert(propertyPairs.end(), j, args.end());
cmAppend(propertyPairs, j, args.end());
break;
}
numFiles++;
+1 -3
View File
@@ -621,9 +621,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop,
}
if (prop == "VARIABLES") {
std::vector<std::string> res = this->Snapshot_.ClosureKeys();
std::vector<std::string> cacheKeys =
this->Snapshot_.State->GetCacheEntryKeys();
res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
cmAppend(res, this->Snapshot_.State->GetCacheEntryKeys());
std::sort(res.begin(), res.end());
output = cmJoin(res, ";");
return output.c_str();
+7 -7
View File
@@ -501,7 +501,7 @@ std::vector<std::string> cmSystemTools::HandleResponseFile(
#else
cmSystemTools::ParseUnixCommandLine(line.c_str(), args2);
#endif
arg_full.insert(arg_full.end(), args2.begin(), args2.end());
cmAppend(arg_full, args2);
}
} else {
arg_full.push_back(arg);
@@ -726,7 +726,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
cmSystemTools::Stdout(strdata);
}
if (captureStdOut) {
tempStdOut.insert(tempStdOut.end(), data, data + length);
cmAppend(tempStdOut, data, data + length);
}
} else if (pipe == cmsysProcess_Pipe_STDERR) {
if (outputflag != OUTPUT_NONE) {
@@ -734,7 +734,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
cmSystemTools::Stderr(strdata);
}
if (captureStdErr) {
tempStdErr.insert(tempStdErr.end(), data, data + length);
cmAppend(tempStdErr, data, data + length);
}
}
}
@@ -1917,26 +1917,26 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
processOutput.DecodeText(data, length, strdata, 1);
// Append to the stdout buffer.
std::vector<char>::size_type size = out.size();
out.insert(out.end(), strdata.begin(), strdata.end());
cmAppend(out, strdata);
outiter = out.begin() + size;
} else if (pipe == cmsysProcess_Pipe_STDERR) {
processOutput.DecodeText(data, length, strdata, 2);
// Append to the stderr buffer.
std::vector<char>::size_type size = err.size();
err.insert(err.end(), strdata.begin(), strdata.end());
cmAppend(err, strdata);
erriter = err.begin() + size;
} else if (pipe == cmsysProcess_Pipe_None) {
// Both stdout and stderr pipes have broken. Return leftover data.
processOutput.DecodeText(std::string(), strdata, 1);
if (!strdata.empty()) {
std::vector<char>::size_type size = out.size();
out.insert(out.end(), strdata.begin(), strdata.end());
cmAppend(out, strdata);
outiter = out.begin() + size;
}
processOutput.DecodeText(std::string(), strdata, 2);
if (!strdata.empty()) {
std::vector<char>::size_type size = err.size();
err.insert(err.end(), strdata.begin(), strdata.end());
cmAppend(err, strdata);
erriter = err.begin() + size;
}
if (!out.empty()) {
+16 -22
View File
@@ -34,13 +34,6 @@
#include "cmTargetPropertyComputer.h"
#include "cmake.h"
//! Append all elements from the second container to the first container
template <class C, class R>
static inline void CApp(C& container, R const& range)
{
container.insert(container.end(), range.begin(), range.end());
}
template <>
const char* cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>(
cmTarget const* tgt)
@@ -406,29 +399,30 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
if (!this->IsImported()) {
// Initialize the INCLUDE_DIRECTORIES property based on the current value
// of the same directory property:
CApp(impl->IncludeDirectoriesEntries,
impl->Makefile->GetIncludeDirectoriesEntries());
CApp(impl->IncludeDirectoriesBacktraces,
impl->Makefile->GetIncludeDirectoriesBacktraces());
cmAppend(impl->IncludeDirectoriesEntries,
impl->Makefile->GetIncludeDirectoriesEntries());
cmAppend(impl->IncludeDirectoriesBacktraces,
impl->Makefile->GetIncludeDirectoriesBacktraces());
{
auto const& sysInc = impl->Makefile->GetSystemIncludeDirectories();
impl->SystemIncludeDirectories.insert(sysInc.begin(), sysInc.end());
}
CApp(impl->CompileOptionsEntries,
impl->Makefile->GetCompileOptionsEntries());
CApp(impl->CompileOptionsBacktraces,
impl->Makefile->GetCompileOptionsBacktraces());
cmAppend(impl->CompileOptionsEntries,
impl->Makefile->GetCompileOptionsEntries());
cmAppend(impl->CompileOptionsBacktraces,
impl->Makefile->GetCompileOptionsBacktraces());
CApp(impl->LinkOptionsEntries, impl->Makefile->GetLinkOptionsEntries());
CApp(impl->LinkOptionsBacktraces,
impl->Makefile->GetLinkOptionsBacktraces());
cmAppend(impl->LinkOptionsEntries,
impl->Makefile->GetLinkOptionsEntries());
cmAppend(impl->LinkOptionsBacktraces,
impl->Makefile->GetLinkOptionsBacktraces());
CApp(impl->LinkDirectoriesEntries,
impl->Makefile->GetLinkDirectoriesEntries());
CApp(impl->LinkDirectoriesBacktraces,
impl->Makefile->GetLinkDirectoriesBacktraces());
cmAppend(impl->LinkDirectoriesEntries,
impl->Makefile->GetLinkDirectoriesEntries());
cmAppend(impl->LinkDirectoriesBacktraces,
impl->Makefile->GetLinkDirectoriesBacktraces());
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
+1 -4
View File
@@ -1045,10 +1045,7 @@ void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
std::vector<std::string> names = gen->GetGeneratorNames();
if (includeNamesWithPlatform) {
std::vector<std::string> namesWithPlatform =
gen->GetGeneratorNamesWithPlatform();
names.insert(names.end(), namesWithPlatform.begin(),
namesWithPlatform.end());
cmAppend(names, gen->GetGeneratorNamesWithPlatform());
}
for (std::string const& name : names) {
+1 -1
View File
@@ -122,7 +122,7 @@ static int do_command(int ac, char const* const* av)
std::vector<std::string> args;
args.reserve(ac - 1);
args.emplace_back(av[0]);
args.insert(args.end(), av + 2, av + ac);
cmAppend(args, av + 2, av + ac);
return cmcmd::ExecuteCMakeCommand(args);
}
+5 -6
View File
@@ -173,7 +173,7 @@ static int HandleIWYU(const std::string& runCmd,
// and adding all the arguments we give to the compiler.
std::vector<std::string> iwyu_cmd;
cmSystemTools::ExpandListArgument(runCmd, iwyu_cmd, true);
iwyu_cmd.insert(iwyu_cmd.end(), orig_cmd.begin() + 1, orig_cmd.end());
cmAppend(iwyu_cmd, orig_cmd.begin() + 1, orig_cmd.end());
// Run the iwyu command line. Capture its stderr and hide its stdout.
// Ignore its return code because the tool always returns non-zero.
std::string stdErr;
@@ -201,11 +201,11 @@ static int HandleTidy(const std::string& runCmd, const std::string& sourceFile,
// automatically skip over the compiler itself and extract the
// options.
int ret;
std::vector<std::string> tidy_cmd;
cmSystemTools::ExpandListArgument(runCmd, tidy_cmd, true);
std::vector<std::string> tidy_cmd =
cmSystemTools::ExpandedListArgument(runCmd, true);
tidy_cmd.push_back(sourceFile);
tidy_cmd.emplace_back("--");
tidy_cmd.insert(tidy_cmd.end(), orig_cmd.begin(), orig_cmd.end());
cmAppend(tidy_cmd, orig_cmd);
// Run the tidy command line. Capture its stdout and hide its stderr.
std::string stdOut;
@@ -1919,8 +1919,7 @@ int cmVSLink::RunMT(std::string const& out, bool notify)
if (this->LinkGeneratesManifest) {
mtCommand.push_back(this->LinkerManifestFile);
}
mtCommand.insert(mtCommand.end(), this->UserManifests.begin(),
this->UserManifests.end());
cmAppend(mtCommand, this->UserManifests);
mtCommand.push_back(out);
if (notify) {
// Add an undocumented option that enables a special return