Source: fix ast-grep suggestions

This commit is contained in:
AJIOB authored and Alex Overchenko committed 2026-09-29 08:50:54 -04:00
1 parent 9b607f9fd6
commit fa60523bf6
42 files changed
+229 -182

No files matched your search

+1 -1
View File
@@ -952,7 +952,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
std::string componentId = "CM_SHORTCUT";
if (!idPrefix.empty()) {
componentId += cmStrCat('_', idPrefix);
componentId = cmStrCat(std::move(componentId), '_', idPrefix);
}
componentId += idSuffix;
+4 -3
View File
@@ -233,11 +233,12 @@ int cmCPackBundleGenerator::SignBundle(std::string const& src_dir)
cmStrCat(this->GetOption("CPACK_COMMAND_CODESIGN"), ' ', sign_parameter,
" -s \"", cpack_apple_cert_app, '"');
if (this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS")) {
temp_codesign_cmd +=
cmStrCat(" --entitlements ",
temp_codesign_cmd =
cmStrCat(std::move(temp_codesign_cmd), " --entitlements ",
this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS"));
}
temp_codesign_cmd += cmStrCat(" \"", bundle_path, '"');
temp_codesign_cmd =
cmStrCat(std::move(temp_codesign_cmd), " \"", bundle_path, '"');
if (!this->RunCommand(temp_codesign_cmd, &output)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
+1 -1
View File
@@ -107,7 +107,7 @@ int cmCPackGenerator::PrepareNames()
{
cmValue toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
if (toplevelTag) {
topDirectory += cmStrCat(toplevelTag, '/');
topDirectory = cmStrCat(std::move(topDirectory), toplevelTag, '/');
}
}
topDirectory += *this->GetOption("CPACK_GENERATOR");
+6 -3
View File
@@ -131,11 +131,13 @@ int cmCPackNSISGenerator::PackageFiles()
std::string installerIconCode;
if (cmValue v = this->GetOptionIfSet("CPACK_NSIS_MUI_ICON")) {
std::string iconFile = cmSystemTools::ConvertToWindowsOutputPath(*v);
installerIconCode += cmStrCat("!define MUI_ICON ", iconFile, '\n');
installerIconCode = cmStrCat(std::move(installerIconCode),
"!define MUI_ICON ", iconFile, '\n');
}
if (cmValue v = this->GetOptionIfSet("CPACK_NSIS_MUI_UNIICON")) {
std::string iconFile = cmSystemTools::ConvertToWindowsOutputPath(*v);
installerIconCode += cmStrCat("!define MUI_UNICON ", iconFile, '\n');
installerIconCode = cmStrCat(std::move(installerIconCode),
"!define MUI_UNICON ", iconFile, '\n');
}
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_ICON_CODE",
installerIconCode.c_str());
@@ -739,7 +741,8 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
std::string const componentOutputDir =
this->CustomComponentInstallDirectory(component->Name);
componentCode += cmStrCat(" SetOutPath \"", componentOutputDir, "\"\n");
componentCode = cmStrCat(std::move(componentCode), " SetOutPath \"",
componentOutputDir, "\"\n");
// Create the actual installation commands
if (component->IsDownloaded) {
+4 -4
View File
@@ -232,8 +232,8 @@ bool cmCTestMultiProcessHandler::ComputeFixtureRepetition()
cmStrCat("Error: the setup and cleanup tests of fixture \"", fi.first,
"\" request conflicting FIXTURE_REPEAT_MODE values:\n");
for (auto const& r : fixture.RequestedModes) {
e += cmStrCat(" \"", this->GetName(r.second), "\" requests ",
FixtureRepeatModeString(r.first), '\n');
e = cmStrCat(std::move(e), " \"", this->GetName(r.second),
"\" requests ", FixtureRepeatModeString(r.first), '\n');
}
e += "All setup and cleanup tests of a fixture must request the same "
"mode.\n";
@@ -263,8 +263,8 @@ bool cmCTestMultiProcessHandler::ComputeFixtureRepetition()
"\" takes part in fixtures with conflicting "
"FIXTURE_REPEAT_MODE values:\n");
for (auto const& m : modes) {
e += cmStrCat(" fixture \"", m.second, "\" uses ",
FixtureRepeatModeString(m.first), '\n');
e = cmStrCat(std::move(e), " fixture \"", m.second, "\" uses ",
FixtureRepeatModeString(m.first), '\n');
}
e += "Fixtures that share a test must use the same mode.\n";
cmCTestLog(this->CTest, ERROR_MESSAGE, e);
+1 -1
View File
@@ -957,7 +957,7 @@ void cmCTestRunTest::SetupResourcesEnvironment(cmEnvironment& env)
var += ';';
}
firstName = false;
var += cmStrCat("id:", it2.Id, ",slots:", it2.Slots);
var = cmStrCat(std::move(var), "id:", it2.Id, ",slots:", it2.Slots);
}
env.PutEnv(var);
}
+6 -6
View File
@@ -1110,18 +1110,18 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
if (setupRegExp.empty()) {
setupRegExp = this->TestOptions.ExcludeFixtureSetupRegularExpression;
} else {
setupRegExp.append(
cmStrCat('(', setupRegExp, ")|(",
this->TestOptions.ExcludeFixtureSetupRegularExpression, ')'));
setupRegExp =
cmStrCat(setupRegExp, '(', setupRegExp, ")|(",
this->TestOptions.ExcludeFixtureSetupRegularExpression, ')');
}
}
if (!this->TestOptions.ExcludeFixtureCleanupRegularExpression.empty()) {
if (cleanupRegExp.empty()) {
cleanupRegExp = this->TestOptions.ExcludeFixtureCleanupRegularExpression;
} else {
cleanupRegExp.append(cmStrCat(
'(', cleanupRegExp, ")|(",
this->TestOptions.ExcludeFixtureCleanupRegularExpression, ')'));
cleanupRegExp = cmStrCat(
cleanupRegExp, '(', cleanupRegExp, ")|(",
this->TestOptions.ExcludeFixtureCleanupRegularExpression, ')');
}
}
cmsys::RegularExpression excludeSetupRegex(setupRegExp);
+33 -30
View File
@@ -493,9 +493,9 @@ bool cmCMakeLanguageCommandPRINT_TARGETS(
continue;
}
}
lines +=
cmStrCat(" ", t.first, " (", cmState::GetTargetTypeName(t.second.Type),
t.second.Imported ? ", IMPORTED" : "", ")\n");
lines = cmStrCat(std::move(lines), " ", t.first, " (",
cmState::GetTargetTypeName(t.second.Type),
t.second.Imported ? ", IMPORTED" : "", ")\n");
anyMatched = true;
}
@@ -509,13 +509,13 @@ bool cmCMakeLanguageCommandPRINT_TARGETS(
} else if (parsedArgs.NoImported) {
label = "Non-imported targets";
}
out += cmStrCat(' ', label);
out = cmStrCat(std::move(out), ' ', label);
if (parsedArgs.Regex) {
out += cmStrCat(
" matching REGEX '", *parsedArgs.Regex, "' (",
out = cmStrCat(
std::move(out), " matching REGEX '", *parsedArgs.Regex, "' (",
parsedArgs.IgnoreCase ? "case insensitive" : "case sensitive", ')');
}
out += cmStrCat(":\n", lines);
out = cmStrCat(std::move(out), ":\n", lines);
makefile.DisplayStatus(out, -1);
}
@@ -567,7 +567,7 @@ void PrintVariablesNamed(cmMakefile& makefile,
}
first = false;
cmValue v = makefile.GetDefinition(name);
msg += cmStrCat(name, "=\"", v ? *v : std::string(), '"');
msg = cmStrCat(std::move(msg), name, "=\"", v ? *v : std::string(), '"');
}
makefile.DisplayStatus(msg, -1);
return;
@@ -577,9 +577,9 @@ void PrintVariablesNamed(cmMakefile& makefile,
for (std::string const& name : names) {
cmValue v = makefile.GetDefinition(name);
if (v) {
out += cmStrCat(" ", name, " = \"", *v, "\"\n");
out = cmStrCat(std::move(out), " ", name, " = \"", *v, "\"\n");
} else {
out += cmStrCat(" ", name, " = <NOTFOUND>\n");
out = cmStrCat(std::move(out), " ", name, " = <NOTFOUND>\n");
}
}
makefile.DisplayStatus(out, -1);
@@ -657,17 +657,18 @@ bool PrintVariablesAll(cmMakefile& makefile, PrintVariablesArgs const& parsed,
for (std::string const& name : names) {
cmValue regular = snapshot.GetDefinition(name);
if (regular && matches(name, *regular)) {
body += cmStrCat(" ", name, " = \"", *regular, "\"\n");
body = cmStrCat(std::move(body), " ", name, " = \"", *regular, "\"\n");
anyMatched = true;
}
cmValue cached = state->GetInitializedCacheValue(name);
if (cached && matches(name, *cached)) {
auto const type = state->GetCacheEntryType(name);
body += cmStrCat(" CACHE{", name, '}');
body = cmStrCat(std::move(body), " CACHE{", name, '}');
if (type != cmStateEnums::UNINITIALIZED) {
body += cmStrCat(':', cmState::CacheEntryTypeToString(type));
body = cmStrCat(std::move(body), ':',
cmState::CacheEntryTypeToString(type));
}
body += cmStrCat(" = \"", *cached, "\"\n");
body = cmStrCat(std::move(body), " = \"", *cached, "\"\n");
anyMatched = true;
}
}
@@ -680,30 +681,30 @@ bool PrintVariablesAll(cmMakefile& makefile, PrintVariablesArgs const& parsed,
if (parsed.NameRegex || parsed.ValueRegex) {
out += " matching";
if (parsed.NameRegex) {
out += cmStrCat(" name '", *parsed.NameRegex, '\'');
out = cmStrCat(std::move(out), " name '", *parsed.NameRegex, '\'');
}
if (parsed.NameRegex && parsed.ValueRegex) {
out += " and";
}
if (parsed.ValueRegex) {
out += cmStrCat(" value '", *parsed.ValueRegex, '\'');
out = cmStrCat(std::move(out), " value '", *parsed.ValueRegex, '\'');
}
out += parsed.IgnoreCase ? " (case insensitive)" : " (case sensitive)";
}
out += cmStrCat(":\n", body);
out = cmStrCat(std::move(out), ":\n", body);
makefile.DisplayStatus(out, -1);
}
if (!anyMatched && (parsed.NameRegex || parsed.ValueRegex)) {
std::string msg = "No variables in scope matching";
if (parsed.NameRegex) {
msg += cmStrCat(" name '", *parsed.NameRegex, '\'');
msg = cmStrCat(std::move(msg), " name '", *parsed.NameRegex, '\'');
}
if (parsed.NameRegex && parsed.ValueRegex) {
msg += " and";
}
if (parsed.ValueRegex) {
msg += cmStrCat(" value '", *parsed.ValueRegex, '\'');
msg = cmStrCat(std::move(msg), " value '", *parsed.ValueRegex, '\'');
}
msg += parsed.IgnoreCase ? " (case insensitive)" : " (case sensitive)";
msg += " in cmake_language(PRINT_VARIABLES ...).";
@@ -836,9 +837,9 @@ std::vector<cmGeneratorTarget const*> CollectDependentTargets(
void WritePropertyLine(std::string& out, std::string const& entityName,
std::string const& propertyName, cmValue value)
{
out += cmStrCat(" ", entityName, '.', propertyName);
out = cmStrCat(std::move(out), " ", entityName, '.', propertyName);
if (value) {
out += cmStrCat(" = \"", *value, '"');
out = cmStrCat(std::move(out), " = \"", *value, '"');
} else {
out += " = <NOTFOUND>";
}
@@ -863,22 +864,22 @@ void EmitBlockHeader(
cm::optional<std::string> const& nameRegexStr = cm::nullopt,
cm::optional<std::string> const& valueRegexStr = cm::nullopt)
{
out +=
cmStrCat(' ', (kind == BlockKind::All ? "All properties" : "Properties"),
" for ", entityType, ' ', entityName);
out = cmStrCat(std::move(out), ' ',
(kind == BlockKind::All ? "All properties" : "Properties"),
" for ", entityType, ' ', entityName);
if (suffix == HeaderSuffix::Reachable) {
out += " (and all reachable)";
}
if (kind == BlockKind::All && (nameRegexStr || valueRegexStr)) {
out += " matching";
if (nameRegexStr) {
out += cmStrCat(" name '", *nameRegexStr, '\'');
out = cmStrCat(std::move(out), " name '", *nameRegexStr, '\'');
}
if (nameRegexStr && valueRegexStr) {
out += " and";
}
if (valueRegexStr) {
out += cmStrCat(" value '", *valueRegexStr, '\'');
out = cmStrCat(std::move(out), " value '", *valueRegexStr, '\'');
}
}
out += ":\n";
@@ -896,13 +897,13 @@ std::string EmptyMatchWarningMessage(
std::string msg =
cmStrCat("No properties for ", entityType, ' ', entityName, " matching");
if (nameRegexStr) {
msg += cmStrCat(" name '", *nameRegexStr, '\'');
msg = cmStrCat(std::move(msg), " name '", *nameRegexStr, '\'');
}
if (nameRegexStr && valueRegexStr) {
msg += " and";
}
if (valueRegexStr) {
msg += cmStrCat(" value '", *valueRegexStr, '\'');
msg = cmStrCat(std::move(msg), " value '", *valueRegexStr, '\'');
}
msg += " in cmake_language(PRINT_PROPERTIES ...).";
return msg;
@@ -1064,7 +1065,8 @@ bool PrintPropertiesConfigureTime(
if (kind == EntityKind::Target) {
cmTarget* target = makefile.FindTargetToUse(entityName);
if (!target) {
out += cmStrCat("\n No such TARGET \"", entityName, "\" !\n\n");
out = cmStrCat(std::move(out), "\n No such TARGET \"", entityName,
"\" !\n\n");
anyEmitted = true;
continue;
}
@@ -1140,7 +1142,8 @@ bool PrintTargetPropertiesDeferred(
for (std::string const& name : targetNames) {
cmGeneratorTarget* root = lg.FindGeneratorTargetToUse(name);
if (!root) {
out += cmStrCat("\n No such TARGET \"", name, "\" !\n\n");
out =
cmStrCat(std::move(out), "\n No such TARGET \"", name, "\" !\n\n");
anyEmitted = true;
continue;
}
+11 -6
View File
@@ -272,7 +272,8 @@ LinkLibraryFeatureAttributeSet const& GetLinkLibraryFeatureAttributes(
featureAttributes.LibraryTypes.emplace(
cm::TargetType::EXECUTABLE);
} else {
errorMessage += cmStrCat(" ", option, '\n');
errorMessage =
cmStrCat(std::move(errorMessage), " ", option, '\n');
break;
}
}
@@ -290,7 +291,8 @@ LinkLibraryFeatureAttributeSet const& GetLinkLibraryFeatureAttributes(
featureAttributes.Deduplication =
LinkLibraryFeatureAttributeSet::Default;
} else {
errorMessage += cmStrCat(" ", option, '\n');
errorMessage =
cmStrCat(std::move(errorMessage), " ", option, '\n');
}
} else if (processingOption.match(1) == "OVERRIDE") {
featureAttributes.Override.clear();
@@ -299,7 +301,7 @@ LinkLibraryFeatureAttributeSet const& GetLinkLibraryFeatureAttributes(
featureAttributes.Override.insert(values.begin(), values.end());
}
} else {
errorMessage += cmStrCat(" ", option, '\n');
errorMessage = cmStrCat(std::move(errorMessage), " ", option, '\n');
}
}
if (!errorMessage.empty()) {
@@ -403,7 +405,8 @@ public:
} else if (processingOption.match(2) == "REVERSE") {
this->Order = Reverse;
} else {
errorMessage += cmStrCat(" ", option, '\n');
errorMessage =
cmStrCat(std::move(errorMessage), " ", option, '\n');
}
} else if (processingOption.match(1) == "UNICITY" ||
processingOption.match(1) == "DEDUPLICATION") {
@@ -414,11 +417,13 @@ public:
} else if (processingOption.match(2) == "SHARED") {
this->Deduplication = Shared;
} else {
errorMessage += cmStrCat(" ", option, '\n');
errorMessage =
cmStrCat(std::move(errorMessage), " ", option, '\n');
}
}
} else {
errorMessage += cmStrCat(" ", option, '\n');
errorMessage =
cmStrCat(std::move(errorMessage), " ", option, '\n');
}
}
if (!errorMessage.empty()) {
+3 -2
View File
@@ -708,7 +708,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
std::string projectLangs;
for (std::string const& li : testLangs) {
projectLangs += cmStrCat(' ', li);
projectLangs = cmStrCat(std::move(projectLangs), ' ', li);
std::string rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE";
std::string rulesOverrideLang = cmStrCat(rulesOverrideBase, '_', li);
if (cmValue rulesOverridePath =
@@ -1090,7 +1090,8 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
if (arguments.LinkLibraries) {
std::string libsToLink = " ";
for (std::string const& i : *arguments.LinkLibraries) {
libsToLink += cmStrCat('"', cmTrimWhitespace(i), "\" ");
libsToLink =
cmStrCat(std::move(libsToLink), '"', cmTrimWhitespace(i), "\" ");
}
fprintf(fout, "target_link_libraries(%s %s)\n", targetName.c_str(),
libsToLink.c_str());
+4 -2
View File
@@ -3,6 +3,7 @@
#include "cmCreateTestSourceList.h"
#include <algorithm>
#include <utility>
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
@@ -93,8 +94,9 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
tests_func_name.end();
tests_func_name.push_back(func_name);
if (!already_declared) {
forwardDeclareCode +=
cmStrCat("extern int ", func_name, "(int, char*[]);\n");
forwardDeclareCode =
cmStrCat(std::move(forwardDeclareCode), "extern int ", func_name,
"(int, char*[]);\n");
}
}
+2 -1
View File
@@ -154,7 +154,8 @@ void Tree::BuildVirtualFolder(cmXMLWriter& xml) const
void Tree::BuildVirtualFolderImpl(std::string& virtualFolders,
std::string const& prefix) const
{
virtualFolders += cmStrCat("CMake Files\\", prefix, this->path, "\\;");
virtualFolders = cmStrCat(std::move(virtualFolders), "CMake Files\\", prefix,
this->path, "\\;");
for (Tree const& folder : this->folders) {
folder.BuildVirtualFolderImpl(virtualFolders,
cmStrCat(prefix, this->path, '\\'));
+9 -7
View File
@@ -435,8 +435,8 @@ void cmFastbuildNormalTargetGenerator::ApplyLWYUToLinkerCommand(
std::string args = " -E __run_co_compile --lwyu=";
args += this->GetLocalGenerator()->EscapeForShell(*lwyuCheck);
args += cmStrCat(
" --source=",
args = cmStrCat(
std::move(args), " --source=",
this->ConvertToFastbuildPath(this->GetGeneratorTarget()->GetFullPath(
Config, cmStateEnums::RuntimeBinaryArtifact,
/*realname=*/true)));
@@ -1946,7 +1946,7 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
? FASTBUILD_OBJECTS_ALIAS_POSTFIX
: FASTBUILD_LINK_ARTIFACTS_ALIAS_POSTFIX);
if (!linkerNode.Arch.empty()) {
dep += cmStrCat('-', linkerNode.Arch);
dep = cmStrCat(std::move(dep), '-', linkerNode.Arch);
}
// If we have a special way of linking the dep, we can't have it in
// ".Libraries" (since there might be multiple such deps, but
@@ -2252,8 +2252,9 @@ void cmFastbuildNormalTargetGenerator::AddLipoCommand(FastbuildTarget& target)
for (auto const& ArchSpecificTarget : target.LinkerNode) {
exec.ExecInput.emplace_back(ArchSpecificTarget.LinkerOutput);
}
exec.ExecArguments += cmStrCat("-create -output ", target.RealOutput, ' ',
cmJoin(exec.ExecInput, " "));
exec.ExecArguments =
cmStrCat(std::move(exec.ExecArguments), "-create -output ",
target.RealOutput, ' ', cmJoin(exec.ExecInput, " "));
target.PostBuildExecNodes.Alias.PreBuildDependencies.emplace(
exec.ExecOutput);
target.PostBuildExecNodes.Nodes.emplace_back(std::move(exec));
@@ -2375,8 +2376,9 @@ void cmFastbuildNormalTargetGenerator::GenerateLink(
this->GetGlobalGenerator()->AddFileToClean(linkerNode.LinkerOutput);
target.RealOutput = targetOutputReal;
if (!arch.empty()) {
linkerNode.Name += cmStrCat('-', arch);
linkerNode.LinkerOutput += cmStrCat('.', arch);
linkerNode.Name = cmStrCat(std::move(linkerNode.Name), '-', arch);
linkerNode.LinkerOutput =
cmStrCat(std::move(linkerNode.LinkerOutput), '.', arch);
linkerNode.Arch = arch;
}
linkerNode.Linker = executable;
+18 -18
View File
@@ -221,12 +221,14 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
if (this->Names.empty()) {
this->VariableDocumentation += "the (unknown) library be found";
} else if (this->Names.size() == 1) {
this->VariableDocumentation +=
cmStrCat("the ", this->Names.front(), " library be found");
this->VariableDocumentation =
cmStrCat(std::move(this->VariableDocumentation), "the ",
this->Names.front(), " library be found");
} else {
this->VariableDocumentation += cmStrCat(
"one of the ", cmJoin(cmMakeRange(this->Names).retreat(1), ", "),
" or ", this->Names.back(), " libraries be found");
this->VariableDocumentation =
cmStrCat(std::move(this->VariableDocumentation), "one of the ",
cmJoin(cmMakeRange(this->Names).retreat(1), ", "), " or ",
this->Names.back(), " libraries be found");
}
}
@@ -698,30 +700,28 @@ void cmFindBaseDebugState::WriteDebug() const
buffer += " NO_DEFAULT_PATH Enabled\n";
} else {
// clang-format off
buffer += cmStrCat(
" CMAKE_FIND_USE_CMAKE_PATH: ", !this->FindCommand->NoCMakePath,
"\n CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: ", !this->FindCommand->NoCMakeEnvironmentPath,
"\n CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: ", !this->FindCommand->NoSystemEnvironmentPath,
"\n CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: ", !this->FindCommand->NoCMakeSystemPath,
"\n CMAKE_FIND_USE_INSTALL_PREFIX: ", !this->FindCommand->NoCMakeInstallPath,
'\n'
);
buffer = cmStrCat(std::move(buffer), " CMAKE_FIND_USE_CMAKE_PATH: ", !this->FindCommand->NoCMakePath,
"\n CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: ", !this->FindCommand->NoCMakeEnvironmentPath,
"\n CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: ", !this->FindCommand->NoSystemEnvironmentPath,
"\n CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: ", !this->FindCommand->NoCMakeSystemPath,
"\n CMAKE_FIND_USE_INSTALL_PREFIX: ", !this->FindCommand->NoCMakeInstallPath,
'\n');
// clang-format on
}
buffer +=
cmStrCat(this->CommandName, " considered the following locations:\n");
buffer = cmStrCat(std::move(buffer), this->CommandName,
" considered the following locations:\n");
for (auto const& state : this->FailedSearchLocations) {
std::string path = cmStrCat(" ", state.path);
if (!state.regexName.empty()) {
path = cmStrCat(std::move(path), '/', state.regexName);
}
buffer += cmStrCat(path, '\n');
buffer = cmStrCat(std::move(buffer), path, '\n');
}
if (this->HasBeenFound()) {
buffer += cmStrCat("The item was found at\n ",
this->FoundSearchLocation.path, '\n');
buffer = cmStrCat(std::move(buffer), "The item was found at\n ",
this->FoundSearchLocation.path, '\n');
} else {
buffer += "The item was not found.\n";
}
+1 -1
View File
@@ -89,7 +89,7 @@ std::size_t collectPathsForDebug(std::string& buffer,
return 0;
}
for (auto i = startIndex; i < paths.size(); i++) {
buffer += cmStrCat(" ", paths[i].Path, '\n');
buffer = cmStrCat(std::move(buffer), " ", paths[i].Path, '\n');
}
return paths.size();
}
+1 -1
View File
@@ -213,7 +213,7 @@ static std::string extractAllGeneratorExpressions(
}
std::string::size_type const traversed = (c - cStart) + 1;
if (!*c) {
result += cmStrCat("$<", input.substr(pos, traversed));
result = cmStrCat(std::move(result), "$<", input.substr(pos, traversed));
}
pos += traversed;
lastPos = pos;
+2 -1
View File
@@ -2900,7 +2900,8 @@ void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const
if (compiler == "Intel") {
cmList targets(arch);
if (!targets.empty()) {
flags += cmStrCat(" --target=", cmWrap("", targets, "", ","));
flags =
cmStrCat(std::move(flags), " --target=", cmWrap("", targets, "", ","));
}
}
}
@@ -196,7 +196,8 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
if (uniqueIncludes.insert(entryInclude).second) {
includes.emplace_back(entryInclude, entry.Backtrace);
if (debugIncludes) {
usedIncludes += cmStrCat(" * ", entryInclude, '\n');
usedIncludes =
cmStrCat(std::move(usedIncludes), " * ", entryInclude, '\n');
}
}
}
+2 -1
View File
@@ -76,7 +76,8 @@ void processLinkDirectories(cmGeneratorTarget const* tgt,
if (uniqueDirectories.insert(entryDirectory).second) {
directories.emplace_back(entryDirectory, entry.Backtrace);
if (debugDirectories) {
usedDirectories += cmStrCat(" * ", entryDirectory, '\n');
usedDirectories =
cmStrCat(std::move(usedDirectories), " * ", entryDirectory, '\n');
}
}
}
+1 -1
View File
@@ -82,7 +82,7 @@ void processOptions(cmGeneratorTarget const* tgt,
options.emplace_back(opt, entry.Backtrace);
}
if (debugOptions) {
usedOptions += cmStrCat(" * ", opt, '\n');
usedOptions = cmStrCat(std::move(usedOptions), " * ", opt, '\n');
}
}
}
+1 -1
View File
@@ -161,7 +161,7 @@ bool processSources(cmGeneratorTarget const* tgt, std::string const& config,
if (uniqueSrcs.insert(src).second) {
srcs.emplace_back(src, entry.Backtrace);
if (debugSources) {
usedSources += cmStrCat(" * ", src, '\n');
usedSources = cmStrCat(std::move(usedSources), " * ", src, '\n');
}
} else {
auto const& fileSets =
+7 -4
View File
@@ -278,14 +278,16 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
// Write explicit dependencies.
for (std::string const& explicitDep : build.ExplicitDeps) {
arguments += cmStrCat(' ', this->EncodePath(explicitDep));
arguments =
cmStrCat(std::move(arguments), ' ', this->EncodePath(explicitDep));
}
// Write implicit dependencies.
if (!build.ImplicitDeps.empty()) {
arguments += " |";
for (std::string const& implicitDep : build.ImplicitDeps) {
arguments += cmStrCat(' ', this->EncodePath(implicitDep));
arguments =
cmStrCat(std::move(arguments), ' ', this->EncodePath(implicitDep));
}
}
@@ -293,7 +295,8 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
if (!build.OrderOnlyDeps.empty()) {
arguments += " ||";
for (std::string const& orderOnlyDep : build.OrderOnlyDeps) {
arguments += cmStrCat(' ', this->EncodePath(orderOnlyDep));
arguments =
cmStrCat(std::move(arguments), ' ', this->EncodePath(orderOnlyDep));
}
}
@@ -3313,7 +3316,7 @@ void cmGlobalNinjaGenerator::AppendDirectoryForConfig(
std::string const& suffix, std::string& dir)
{
if (!config.empty() && this->IsMultiConfig()) {
dir += cmStrCat(prefix, config, suffix);
dir = cmStrCat(std::move(dir), prefix, config, suffix);
}
}
+1 -1
View File
@@ -225,7 +225,7 @@ void cmGlobalVisualStudio7Generator::AppendDirectoryForConfig(
std::string const& suffix, std::string& dir)
{
if (!config.empty()) {
dir += cmStrCat(prefix, config, suffix);
dir = cmStrCat(std::move(dir), prefix, config, suffix);
}
}
+4 -2
View File
@@ -2726,7 +2726,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::set<std::string> defines(targetSwiftDefines.begin(),
targetSwiftDefines.end());
this->CurrentLocalGenerator->JoinDefines(defines, defineString, "Swift");
cflags["Swift"] += cmStrCat(' ', defineString);
cflags["Swift"] =
cmStrCat(std::move(cflags["Swift"]), ' ', defineString);
} else {
BuildObjectListOrString swiftDefs(this, true);
this->AppendDefines(swiftDefs, targetSwiftDefines);
@@ -3108,7 +3109,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
includes, gtgt, language, configName);
if (!includeFlags.empty()) {
cflags[language] += cmStrCat(' ', includeFlags);
cflags[language] =
cmStrCat(std::move(cflags[language]), ' ', includeFlags);
}
}
}
+4 -4
View File
@@ -145,8 +145,8 @@ void cmLinkLineComputer::ComputeLinkPath(
type = cmStateEnums::ImportLibraryArtifact;
}
linkPathNoBT +=
cmStrCat(' ', libPathFlag,
linkPathNoBT =
cmStrCat(std::move(linkPathNoBT), ' ', libPathFlag,
this->ConvertToOutputForExisting(
item.Target->GetDirectory(cli.GetConfig(), type)),
libPathTerminator, ' ');
@@ -210,8 +210,8 @@ std::string cmLinkLineComputer::ComputeFrameworkPath(
std::string frameworkPath;
for (auto const& fd : cli.GetFrameworkPaths()) {
frameworkPath +=
cmStrCat(fwSearchFlag, this->ConvertToOutputFormat(fd), ' ');
frameworkPath = cmStrCat(std::move(frameworkPath), fwSearchFlag,
this->ConvertToOutputFormat(fd), ' ');
}
return frameworkPath;
}
+1 -1
View File
@@ -1139,7 +1139,7 @@ std::string& cmList::append(std::string& list, std::string&& value)
if (list.empty()) {
list = std::move(value);
} else {
list += cmStrCat(cmList::element_separator, value);
list = cmStrCat(std::move(list), cmList::element_separator, value);
}
return list;
+1 -1
View File
@@ -3819,7 +3819,7 @@ void cmLocalGenerator::AppendWarningAsErrorLinkerFlags(
std::string errorMessage;
for (auto const& option : wErrorOptions) {
if (option != "DRIVER"_s && option != "LINKER"_s) {
errorMessage += cmStrCat(" ", option, '\n');
errorMessage = cmStrCat(std::move(errorMessage), " ", option, '\n');
continue;
}
+1 -1
View File
@@ -440,7 +440,7 @@ std::string cmLocalNinjaGenerator::WriteCommandScript(
scriptPath += '/';
scriptPath += customStep;
if (this->GlobalGenerator->IsMultiConfig()) {
scriptPath += cmStrCat('-', commandConfig);
scriptPath = cmStrCat(std::move(scriptPath), '-', commandConfig);
}
#ifdef _WIN32
scriptPath += ".bat";
+20 -19
View File
@@ -317,12 +317,12 @@ void cmMakefile::MaybeWarnCMP0074(std::string const& rootVar, cmValue rootDef,
if ((rootDef || rootEnv) && this->WarnedCMP0074.insert(rootVar).second) {
std::string e;
if (rootDef) {
e += cmStrCat("CMake variable ", rootVar, " is set to:\n ", *rootDef,
'\n');
e = cmStrCat(std::move(e), "CMake variable ", rootVar, " is set to:\n ",
*rootDef, '\n');
}
if (rootEnv) {
e += cmStrCat("Environment variable ", rootVar, " is set to:\n ",
*rootEnv, '\n');
e = cmStrCat(std::move(e), "Environment variable ", rootVar,
" is set to:\n ", *rootEnv, '\n');
}
e += "For compatibility, CMake is ignoring the variable.";
this->IssuePolicyWarning(cmPolicies::CMP0074, {}, e);
@@ -336,12 +336,12 @@ void cmMakefile::MaybeWarnCMP0144(std::string const& rootVar, cmValue rootDef,
if ((rootDef || rootEnv) && this->WarnedCMP0144.insert(rootVar).second) {
std::string e;
if (rootDef) {
e += cmStrCat("CMake variable ", rootVar, " is set to:\n ", *rootDef,
'\n');
e = cmStrCat(std::move(e), "CMake variable ", rootVar, " is set to:\n ",
*rootDef, '\n');
}
if (rootEnv) {
e += cmStrCat("Environment variable ", rootVar, " is set to:\n ",
*rootEnv, '\n');
e = cmStrCat(std::move(e), "Environment variable ", rootVar,
" is set to:\n ", *rootEnv, '\n');
}
e += "For compatibility, find_package is ignoring the variable, but "
"code in a .cmake module might still use it.";
@@ -1186,15 +1186,15 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
std::string e;
if (cmTarget const* t = this->FindTargetToUse(target)) {
if (t->IsImported()) {
e += cmStrCat("TARGET '", target,
"' is IMPORTED and does not build here.");
e = cmStrCat(std::move(e), "TARGET '", target,
"' is IMPORTED and does not build here.");
} else {
e +=
cmStrCat("TARGET '", target, "' was not created in this directory.");
e = cmStrCat(std::move(e), "TARGET '", target,
"' was not created in this directory.");
}
} else {
e += cmStrCat("No TARGET '", target,
"' has been created in this directory.");
e = cmStrCat(std::move(e), "No TARGET '", target,
"' has been created in this directory.");
}
this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e, lfbt);
return nullptr;
@@ -2725,7 +2725,7 @@ void cmMakefile::IssueCMP0219Warning(
if (!oldArgs.empty()) {
oldArgs += '\n';
}
oldArgs += cmStrCat(" \"", arg, '"');
oldArgs = cmStrCat(std::move(oldArgs), " \"", arg, '"');
}
std::string newArgs = oldArgs;
@@ -2961,10 +2961,11 @@ MessageType cmMakefile::ExpandVariablesInStringImpl(
if (!openstack.empty() &&
!(cmsysString_isalnum(inc) || inc == '_' || inc == '/' ||
inc == '.' || inc == '+' || inc == '-')) {
errorstr += cmStrCat("Invalid character ('", inc);
errorstr =
cmStrCat(std::move(errorstr), "Invalid character ('", inc);
result.append(last, in - last);
errorstr += cmStrCat("') in a variable name: '",
result.substr(openstack.back().loc), '\'');
errorstr = cmStrCat(std::move(errorstr), "') in a variable name: '",
result.substr(openstack.back().loc), '\'');
mtype = MessageType::FATAL_ERROR;
error = true;
}
@@ -2986,7 +2987,7 @@ MessageType cmMakefile::ExpandVariablesInStringImpl(
// This filename and line number may be more specific than the
// command context because one command invocation can have
// arguments on multiple lines.
e += cmStrCat("at\n ", filename, ':', line, '\n');
e = cmStrCat(std::move(e), "at\n ", filename, ':', line, '\n');
}
errorstr = cmStrCat(e, "when parsing string\n ", source, '\n',
std::move(errorstr));
@@ -618,7 +618,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL),
" -E __run_co_compile --lwyu=");
cmakeCommand += this->LocalGenerator->EscapeForShell(*lwyuCheck);
cmakeCommand += cmStrCat(" --source=", targetOutPathReal);
cmakeCommand =
cmStrCat(std::move(cmakeCommand), " --source=", targetOutPathReal);
real_link_commands.push_back(std::move(cmakeCommand));
}
}
+2 -1
View File
@@ -953,7 +953,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL),
" -E __run_co_compile --lwyu=");
cmakeCommand += this->LocalGenerator->EscapeForShell(*lwyuCheck);
cmakeCommand += cmStrCat(" --source=", targetOutPathReal);
cmakeCommand =
cmStrCat(std::move(cmakeCommand), " --source=", targetOutPathReal);
real_link_commands.push_back(std::move(cmakeCommand));
}
}
+12 -9
View File
@@ -1174,17 +1174,18 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// compiler must be launched through a wrapper to pick-up dependencies
std::string depFilter =
"$(CMAKE_COMMAND) -E cmake_cl_compile_depends ";
depFilter += cmStrCat("--dep-file=", shellDependencyFile);
depFilter +=
cmStrCat(" --working-dir=",
depFilter =
cmStrCat(std::move(depFilter), "--dep-file=", shellDependencyFile);
depFilter =
cmStrCat(std::move(depFilter), " --working-dir=",
this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->GetCurrentBinaryDirectory(),
cmOutputConverter::SHELL));
auto const& prefix = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_CL_SHOWINCLUDES_PREFIX"));
depFilter += cmStrCat(" --filter-prefix=",
this->LocalGenerator->ConvertToOutputFormat(
prefix, cmOutputConverter::SHELL));
depFilter = cmStrCat(std::move(depFilter), " --filter-prefix=",
this->LocalGenerator->ConvertToOutputFormat(
prefix, cmOutputConverter::SHELL));
depFilter += " -- ";
compileCommands.front().insert(0, depFilter);
}
@@ -1698,7 +1699,8 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
std::string const cubin =
cmStrCat(objectDir, "sm_", architecture, ".cubin");
profiles += cmStrCat(" -im=profile=sm_", architecture, ",file=", cubin);
profiles = cmStrCat(std::move(profiles), " -im=profile=sm_", architecture,
",file=", cubin);
fatbinaryDepends.emplace_back(cubin);
std::string command = cmStrCat(
@@ -2310,8 +2312,9 @@ void cmMakefileTargetGenerator::CreateObjectLists(
std::string objects_rsp = this->CreateResponseFile(
responseFileName, object_strings[i], makefile_depends, linkLanguage);
buildObjs +=
cmStrCat(sep, // Separate from previous response file references.
buildObjs =
cmStrCat(std::move(buildObjs),
sep, // Separate from previous response file references.
responseFlag, // Reference the response file.
this->LocalGenerator->ConvertToOutputFormat(
objects_rsp, cmOutputConverter::SHELL));
+7 -5
View File
@@ -771,7 +771,8 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
this->ConvertToNinjaPath(this->GetGeneratorTarget()->GetFullPath(
config, cmStateEnums::RuntimeBinaryArtifact,
/*realname=*/true));
cmakeCommand += cmStrCat(" --source=", targetOutputReal);
cmakeCommand =
cmStrCat(std::move(cmakeCommand), " --source=", targetOutputReal);
linkCmds.push_back(std::move(cmakeCommand));
}
}
@@ -944,8 +945,9 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatements(
"--register-link-binaries=", ninjaOutputDir, "/cmake_cuda_register.h");
}
fatbinary.Variables["PROFILES"] +=
cmStrCat(" -im=profile=sm_", architecture, ",file=", cubin);
fatbinary.Variables["PROFILES"] =
cmStrCat(std::move(fatbinary.Variables["PROFILES"]), " -im=profile=sm_",
architecture, ",file=", cubin);
fatbinary.ExplicitDeps.emplace_back(cubin);
globalGen->WriteBuild(this->GetCommonFileStream(), dlink);
@@ -1401,8 +1403,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
std::string rspPath =
cmStrCat(this->GeneratorTarget->GetSupportDirectory(), configDir,
"/CXXInterfaceObjects.rsp");
vars["LINK_FLAGS"] += cmStrCat(
" @",
vars["LINK_FLAGS"] = cmStrCat(
std::move(vars["LINK_FLAGS"]), " @",
this->GetLocalGenerator()->ConvertToOutputFormat(
this->ConvertToNinjaPath(rspPath), cmOutputConverter::SHELL));
linkBuild.ImplicitDeps.emplace_back(this->ConvertToNinjaPath(rspPath));
+6 -5
View File
@@ -555,7 +555,7 @@ std::string cmNinjaTargetGenerator::GetTargetFilePath(
if (path.empty() || path == ".") {
return name;
}
path += cmStrCat('/', name);
path = cmStrCat(std::move(path), '/', name);
return path;
}
@@ -920,7 +920,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(std::string const& lang,
// source if that was performed).
std::string ddModmapArg;
if (!modmapFormat.empty()) {
ddModmapArg += cmStrCat(" --modmapfmt=", modmapFormat);
ddModmapArg =
cmStrCat(std::move(ddModmapArg), " --modmapfmt=", modmapFormat);
}
{
std::vector<std::string> ddCmds;
@@ -984,7 +985,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(std::string const& lang,
if (!depfileFlags.empty()) {
rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
depfileFlags, vars);
flags += cmStrCat(' ', depfileFlags);
flags = cmStrCat(std::move(flags), ' ', depfileFlags);
}
}
@@ -993,7 +994,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(std::string const& lang,
mf->GetRequiredDefinition(cmStrCat("CMAKE_", lang, "_MODULE_MAP_FLAG"));
cmSystemTools::ReplaceString(modmapFlags, "<MODULE_MAP_FILE>",
"$DYNDEP_MODULE_MAP_FILE");
flags += cmStrCat(' ', modmapFlags);
flags = cmStrCat(std::move(flags), ' ', modmapFlags);
}
vars.Flags = flags.c_str();
@@ -2614,7 +2615,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
// corresponding file path.
cmSystemTools::ReplaceString(modmapFlags, "<MODULE_MAP_FILE>",
cmStrCat(objectFileName, ".modmap"));
fullFlags += cmStrCat(' ', modmapFlags);
fullFlags = cmStrCat(std::move(fullFlags), ' ', modmapFlags);
}
}
+2 -2
View File
@@ -347,10 +347,10 @@ bool cmQtAutoGen::RccLister::list(std::string const& qrcFile,
error =
cmStrCat("The rcc list process failed for ", Quoted(qrcFile), '\n');
if (!rccStdOut.empty()) {
error += cmStrCat(rccStdOut, '\n');
error = cmStrCat(std::move(error), rccStdOut, '\n');
}
if (!rccStdErr.empty()) {
error += cmStrCat(rccStdErr, '\n');
error = cmStrCat(std::move(error), rccStdErr, '\n');
}
return false;
}
+6 -5
View File
@@ -961,7 +961,7 @@ bool cmQtAutoGenInitializer::InitRcc()
this->GenTarget->GetSafeProperty(kw.AUTORCC_OPTIONS);
std::string const nozstd = "--no-zstd";
if (rccOptions.find(nozstd) == std::string::npos) {
rccOptions.append(cmStrCat(';', nozstd, ';'));
rccOptions = cmStrCat(std::move(rccOptions), ';', nozstd, ';');
}
this->GenTarget->Target->SetProperty(kw.AUTORCC_OPTIONS, rccOptions);
}
@@ -1251,7 +1251,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
}
std::string files;
for (MUFile const* muf : this->AutogenTarget.FilesGenerated) {
files += cmStrCat(" ", Quoted(muf->FullPath), '\n');
files = cmStrCat(std::move(files), " ", Quoted(muf->FullPath), '\n');
}
this->Makefile->IssuePolicyWarning(
cmPolicies::CMP0071, {},
@@ -1281,7 +1281,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
}
std::string files;
for (cmSourceFile const* sf : this->AutogenTarget.CMP0100HeadersWarn) {
files += cmStrCat(" ", Quoted(sf->GetFullPath()), '\n');
files =
cmStrCat(std::move(files), " ", Quoted(sf->GetFullPath()), '\n');
}
this->Makefile->IssuePolicyWarning(
cmPolicies::CMP0100, {},
@@ -1349,7 +1350,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// Replace '-' with '_'. The former is not valid for symbol names.
std::replace(name.begin(), name.end(), '-', '_');
if (!qrc.Unique) {
name += cmStrCat('_', qrc.QrcPathChecksum);
name = cmStrCat(std::move(name), '_', qrc.QrcPathChecksum);
}
std::vector<std::string> nameOpts;
nameOpts.emplace_back("-name");
@@ -1899,7 +1900,7 @@ bool cmQtAutoGenInitializer::InitRccTargets()
{
ccName = cmStrCat(this->GenTarget->GetName(), "_arcc_", qrc.QrcName);
if (!qrc.Unique) {
ccName += cmStrCat('_', qrc.QrcPathChecksum);
ccName = cmStrCat(std::move(ccName), '_', qrc.QrcPathChecksum);
}
cc->SetByproducts(ccOutput);
+5 -3
View File
@@ -3,6 +3,7 @@
#include "cmQtAutoGenerator.h"
#include <iterator>
#include <utility>
#include <cm3p/json/reader.h>
@@ -105,9 +106,10 @@ void cmQtAutoGenerator::Logger::ErrorCommand(
std::string msg = cmStrCat(
'\n', HeadLine(cmStrCat(GeneratorName(genType), " subprocess error")),
message, cmHasSuffix(message, '\n') ? "\n" : "\n\n");
msg += cmStrCat(HeadLine("Command"), QuotedCommand(command), "\n\n");
msg += cmStrCat(HeadLine("Output"), output,
cmHasSuffix(output, '\n') ? "\n" : "\n\n");
msg = cmStrCat(std::move(msg), HeadLine("Command"), QuotedCommand(command),
"\n\n");
msg = cmStrCat(std::move(msg), HeadLine("Output"), output,
cmHasSuffix(output, '\n') ? "\n" : "\n\n");
{
std::lock_guard<std::mutex> lock(this->Mutex_);
cmSystemTools::Stderr(msg);
+9 -5
View File
@@ -1576,7 +1576,8 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::RegisterIncluded(
std::string files =
cmStrCat(" ", this->MessagePath(includerFileHandle->FileName), '\n');
for (auto const& item : handle->IncluderFiles) {
files += cmStrCat(" ", this->MessagePath(item->FileName), '\n');
files = cmStrCat(std::move(files), " ",
this->MessagePath(item->FileName), '\n');
}
this->LogError(
GenT::MOC,
@@ -1772,7 +1773,8 @@ bool cmQtAutoMocUicT::JobEvalCacheUicT::RegisterMapping(
std::string files =
cmStrCat(" ", this->MessagePath(includerFileHandle->FileName), '\n');
for (auto const& item : handle->IncluderFiles) {
files += cmStrCat(" ", this->MessagePath(item->FileName), '\n');
files = cmStrCat(std::move(files), " ",
this->MessagePath(item->FileName), '\n');
}
this->LogError(
GenT::UIC,
@@ -2194,7 +2196,8 @@ void cmQtAutoMocUicT::JobCompileMocT::Process()
if (!this->Mapping->IncluderFiles.empty()) {
includers = "included by\n";
for (auto const& item : this->Mapping->IncluderFiles) {
includers += cmStrCat(" ", this->MessagePath(item->FileName), '\n');
includers = cmStrCat(std::move(includers), " ",
this->MessagePath(item->FileName), '\n');
}
}
this->LogCommandError(GenT::MOC,
@@ -2265,7 +2268,8 @@ void cmQtAutoMocUicT::JobCompileUicT::Process()
// Uic command failed
std::string includers;
for (auto const& item : this->Mapping->IncluderFiles) {
includers += cmStrCat(" ", this->MessagePath(item->FileName), '\n');
includers = cmStrCat(std::move(includers), " ",
this->MessagePath(item->FileName), '\n');
}
this->LogCommandError(GenT::UIC,
cmStrCat("The uic process failed to compile\n ",
@@ -3069,7 +3073,7 @@ bool cmQtAutoMocUicT::SettingsFileWrite()
auto SettingAppend = [&content](cm::string_view key,
cm::string_view value) {
if (!value.empty()) {
content += cmStrCat(key, ':', value, '\n');
content = cmStrCat(std::move(content), key, ':', value, '\n');
}
};
SettingAppend("moc", this->SettingsStringMoc_);
+2 -1
View File
@@ -3,6 +3,7 @@
#include "cmSeparateArgumentsCommand.h"
#include <algorithm>
#include <utility>
#include <cm/string_view>
#include <cmext/string_view>
@@ -116,7 +117,7 @@ bool cmSeparateArgumentsCommand(std::vector<std::string> const& args,
}
if (!program.empty()) {
program += cmStrCat(';', programArgs);
program = cmStrCat(std::move(program), ';', programArgs);
}
status.GetMakefile().AddDefinition(var, program);
+3 -2
View File
@@ -3,6 +3,7 @@
#include "cmTargetIncludeDirectoriesCommand.h"
#include <set>
#include <utility>
#include <cm/optional>
@@ -51,9 +52,9 @@ std::string TargetIncludeDirectoriesImpl::Join(
for (std::string const& it : content) {
if (cmSystemTools::FileIsFullPath(it) ||
cmGeneratorExpression::Find(it) == 0) {
dirs += cmStrCat(sep, it);
dirs = cmStrCat(std::move(dirs), sep, it);
} else {
dirs += cmStrCat(sep, prefix, it);
dirs = cmStrCat(std::move(dirs), sep, prefix, it);
}
sep = ";";
}
+20 -17
View File
@@ -3,6 +3,7 @@
#include "cmTryRunCommand.h"
#include <stdexcept>
#include <utility>
#include <cm/optional>
#include <cmext/string_view>
@@ -273,7 +274,8 @@ void TryRunCommandImpl::RunExecutable(std::string const& runArgs,
this->Makefile->GetSafeDefinition("CMAKE_CROSSCOMPILING_EMULATOR");
if (!emulator.empty()) {
cmList emulatorWithArgs{ emulator };
finalCommand += cmStrCat(
finalCommand = cmStrCat(
std::move(finalCommand),
cmSystemTools::ConvertToRunCommandPath(emulatorWithArgs[0]), ' ',
cmWrap("\"", cmMakeRange(emulatorWithArgs).advance(1), "\"", " "), ' ');
}
@@ -444,8 +446,8 @@ void TryRunCommandImpl::DoNotRunExecutable(
"enter \"FAILED_TO_RUN\".\n");
if (stdOut || stdErr) {
if (stdOut) {
comment += cmStrCat(
internalRunOutputStdOutName,
comment = cmStrCat(
std::move(comment), internalRunOutputStdOutName,
"\n contains the text the executable would have printed on "
"stdout.\n"
" If the executable would not have been able to run, set ",
@@ -457,8 +459,8 @@ void TryRunCommandImpl::DoNotRunExecutable(
"called with the given arguments.\n");
}
if (stdErr) {
comment += cmStrCat(
internalRunOutputStdErrName,
comment = cmStrCat(
std::move(comment), internalRunOutputStdErrName,
"\n contains the text the executable would have printed on "
"stderr.\n"
" If the executable would not have been able to run, set ",
@@ -470,8 +472,8 @@ void TryRunCommandImpl::DoNotRunExecutable(
"called with the given arguments.\n");
}
} else if (out) {
comment += cmStrCat(
internalRunOutputName,
comment = cmStrCat(
std::move(comment), internalRunOutputName,
"\n contains the text the executable would have printed on stdout "
"and stderr.\n"
" If the executable would not have been able to run, set ",
@@ -483,19 +485,20 @@ void TryRunCommandImpl::DoNotRunExecutable(
"called with the given arguments.\n");
}
comment +=
cmStrCat("The ", compileResultVariable,
comment =
cmStrCat(std::move(comment), "The ", compileResultVariable,
" variable holds the build result for this try_run().\n\n");
if (srcFile) {
comment += cmStrCat("Source file : ", *srcFile, '\n');
comment =
cmStrCat(std::move(comment), "Source file : ", *srcFile, '\n');
}
comment += cmStrCat("Executable : ", copyDest,
"\n"
"Run arguments : ",
runArgs,
"\n"
" Called from: ",
this->Makefile->FormatListFileStack());
comment = cmStrCat(std::move(comment), "Executable : ", copyDest,
"\n"
"Run arguments : ",
runArgs,
"\n"
" Called from: ",
this->Makefile->FormatListFileStack());
cmsys::SystemTools::ReplaceString(comment, "\n", "\n# ");
file << comment << "\n\n";
+1 -1
View File
@@ -3557,7 +3557,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
if (!clrString.empty()) {
clrString = cmStrCat(':', std::move(clrString));
}
flags += cmStrCat(" /clr", clrString);
flags = cmStrCat(std::move(flags), " /clr", clrString);
}
}