Commit 86dc86dd authored by Pavel Solodovnikov's avatar Pavel Solodovnikov

Add const-reference qualifications

parent 76bdb407
......@@ -24,7 +24,7 @@ bool cmAddCustomTargetCommand::InitialPass(
return false;
}
std::string targetName = args[0];
std::string const& targetName = args[0];
// Check the target name.
if (targetName.find_first_of("/\\") != targetName.npos) {
......
......@@ -19,7 +19,7 @@ bool cmAddDependenciesCommand::InitialPass(
return false;
}
std::string target_name = args[0];
std::string const& target_name = args[0];
if (this->Makefile->IsAlias(target_name)) {
std::ostringstream e;
e << "Cannot add target-level dependencies to alias target \""
......
......@@ -24,7 +24,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
}
std::vector<std::string>::const_iterator s = args.begin();
std::string exename = *s;
std::string const& exename = *s;
++s;
bool use_win32 = false;
......
......@@ -37,7 +37,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
std::vector<std::string>::const_iterator s = args.begin();
std::string libName = *s;
std::string const& libName = *s;
++s;
......
......@@ -20,7 +20,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
}
// store the binpath
std::string srcArg = args[0];
std::string const& srcArg = args[0];
std::string binArg;
bool excludeFromAll = false;
......
......@@ -24,7 +24,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
}
std::string sourceListValue;
std::string templateDirectory = args[0];
std::string const& templateDirectory = args[0];
std::string tdir;
if (!cmSystemTools::FileIsFullPath(templateDirectory.c_str())) {
tdir = this->Makefile->GetCurrentSourceDirectory();
......@@ -54,7 +54,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
std::string ext = file.substr(dotpos + 1);
std::string base = file.substr(0, dotpos);
// Process only source files
std::vector<std::string> srcExts =
std::vector<std::string> const& srcExts =
this->Makefile->GetCMakeInstance()->GetSourceExtensions();
if (!base.empty() &&
std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end()) {
......
......@@ -32,7 +32,7 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
}
// The cmake variable in which to store the result.
const char* variable = args[0].c_str();
std::string const& variable = args[0];
// Parse remaining arguments.
std::string configuration;
......@@ -104,7 +104,7 @@ bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args)
return false;
}
const char* define = args[0].c_str();
std::string const& define = args[0];
const char* cacheValue = this->Makefile->GetDefinition(define);
std::string configType;
......
......@@ -26,7 +26,7 @@ bool cmCMakeHostSystemInformationCommand::InitialPass(
return false;
}
std::string variable = args[current_index + 1];
std::string const& variable = args[current_index + 1];
current_index += 2;
if (args.size() < (current_index + 2) || args[current_index] != "QUERY") {
......@@ -41,7 +41,7 @@ bool cmCMakeHostSystemInformationCommand::InitialPass(
std::string result_list;
for (size_t i = current_index + 1; i < args.size(); ++i) {
std::string key = args[i];
std::string const& key = args[i];
if (i != current_index + 1) {
result_list += ";";
}
......
......@@ -19,7 +19,7 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
const char* inFile = args[0].c_str();
std::string const& inFile = args[0];
if (!cmSystemTools::FileIsFullPath(inFile)) {
this->InputFile = this->Makefile->GetCurrentSourceDirectory();
this->InputFile += "/";
......@@ -38,7 +38,7 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
const char* outFile = args[1].c_str();
std::string const& outFile = args[1];
if (!cmSystemTools::FileIsFullPath(outFile)) {
this->OutputFile = this->Makefile->GetCurrentBinaryDirectory();
this->OutputFile += "/";
......
......@@ -20,23 +20,25 @@ bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,
// Get the scope in which to define the property.
cmProperty::ScopeType scope;
if (args[0] == "GLOBAL") {
std::string const& scope_arg = args[0];
if (scope_arg == "GLOBAL") {
scope = cmProperty::GLOBAL;
} else if (args[0] == "DIRECTORY") {
} else if (scope_arg == "DIRECTORY") {
scope = cmProperty::DIRECTORY;
} else if (args[0] == "TARGET") {
} else if (scope_arg == "TARGET") {
scope = cmProperty::TARGET;
} else if (args[0] == "SOURCE") {
} else if (scope_arg == "SOURCE") {
scope = cmProperty::SOURCE_FILE;
} else if (args[0] == "TEST") {
} else if (scope_arg == "TEST") {
scope = cmProperty::TEST;
} else if (args[0] == "VARIABLE") {
} else if (scope_arg == "VARIABLE") {
scope = cmProperty::VARIABLE;
} else if (args[0] == "CACHED_VARIABLE") {
} else if (scope_arg == "CACHED_VARIABLE") {
scope = cmProperty::CACHED_VARIABLE;
} else {
std::ostringstream e;
e << "given invalid scope " << args[0] << ". "
e << "given invalid scope " << scope_arg << ". "
<< "Valid scopes are "
<< "GLOBAL, DIRECTORY, TARGET, SOURCE, "
<< "TEST, VARIABLE, CACHED_VARIABLE.";
......
......@@ -353,7 +353,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
all_files_map_t allFiles;
std::vector<std::string> cFiles;
std::vector<std::string> srcExts =
std::vector<std::string> const& srcExts =
this->GlobalGenerator->GetCMakeInstance()->GetSourceExtensions();
for (std::vector<cmLocalGenerator*>::const_iterator lg = lgs.begin();
......@@ -387,7 +387,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
bool isCFile = false;
std::string lang = (*si)->GetLanguage();
if (lang == "C" || lang == "CXX") {
std::string srcext = (*si)->GetExtension();
std::string const& srcext = (*si)->GetExtension();
for (std::vector<std::string>::const_iterator ext =
srcExts.begin();
ext != srcExts.end(); ++ext) {
......@@ -398,7 +398,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
}
}
std::string fullPath = (*si)->GetFullPath();
std::string const& fullPath = (*si)->GetFullPath();
if (isCFile) {
cFiles.push_back(fullPath);
......@@ -414,7 +414,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
}
}
std::vector<std::string> headerExts =
std::vector<std::string> const& headerExts =
this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
// The following loop tries to add header files matching to implementation
......
......@@ -240,7 +240,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
bool isCFile = false;
std::string lang = (*si)->GetLanguage();
if (lang == "C" || lang == "CXX") {
std::string srcext = (*si)->GetExtension();
std::string const& srcext = (*si)->GetExtension();
for (std::vector<std::string>::const_iterator ext = srcExts.begin();
ext != srcExts.end(); ++ext) {
if (srcext == *ext) {
......
......@@ -453,7 +453,7 @@ void cmExtraEclipseCDT4Generator::WriteGroups(
for (std::vector<const cmSourceFile*>::const_iterator fileIt =
sFiles.begin();
fileIt != sFiles.end(); ++fileIt) {
std::string fullPath = (*fileIt)->GetFullPath();
std::string const& fullPath = (*fileIt)->GetFullPath();
if (!cmSystemTools::FileIsDirectory(fullPath)) {
std::string linkName4 = linkName3;
......@@ -508,7 +508,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
for (std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
sfIt != files.end(); sfIt++) {
// Add the file to the list of sources.
std::string source = (*sfIt)->GetFullPath();
std::string const& source = (*sfIt)->GetFullPath();
cmSourceGroup* sourceGroup =
makefile->FindSourceGroup(source.c_str(), sourceGroups);
sourceGroup->AssignSource(*sfIt);
......
......@@ -110,7 +110,7 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
this->SetError("must be called with at least two arguments.");
return false;
}
std::string subCommand = args[0];
std::string const& subCommand = args[0];
if (subCommand == "WRITE") {
return this->HandleWriteCommand(args, false);
}
......
......@@ -924,7 +924,7 @@ bool cmFindPackageCommand::FindConfig()
bool cmFindPackageCommand::FindPrefixedConfig()
{
std::vector<std::string>& prefixes = this->SearchPaths;
std::vector<std::string> const& prefixes = this->SearchPaths;
for (std::vector<std::string>::const_iterator pi = prefixes.begin();
pi != prefixes.end(); ++pi) {
if (this->SearchPrefix(*pi)) {
......@@ -936,7 +936,7 @@ bool cmFindPackageCommand::FindPrefixedConfig()
bool cmFindPackageCommand::FindFrameworkConfig()
{
std::vector<std::string>& prefixes = this->SearchPaths;
std::vector<std::string> const& prefixes = this->SearchPaths;
for (std::vector<std::string>::const_iterator i = prefixes.begin();
i != prefixes.end(); ++i) {
if (this->SearchFrameworkPrefix(*i)) {
......@@ -948,7 +948,7 @@ bool cmFindPackageCommand::FindFrameworkConfig()
bool cmFindPackageCommand::FindAppBundleConfig()
{
std::vector<std::string>& prefixes = this->SearchPaths;
std::vector<std::string> const& prefixes = this->SearchPaths;
for (std::vector<std::string>::const_iterator i = prefixes.begin();
i != prefixes.end(); ++i) {
if (this->SearchAppBundlePrefix(*i)) {
......
......@@ -20,7 +20,7 @@ bool cmGetCMakePropertyCommand::InitialPass(
return false;
}
std::string variable = args[0];
std::string const& variable = args[0];
std::string output = "NOTFOUND";
if (args[1] == "VARIABLES") {
......
......@@ -20,7 +20,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
}
std::vector<std::string>::const_iterator i = args.begin();
std::string variable = *i;
std::string const& variable = *i;
++i;
// get the directory argument if there is one
......
......@@ -15,8 +15,8 @@ bool cmGetSourceFilePropertyCommand::InitialPass(
this->SetError("called with incorrect number of arguments");
return false;
}
const char* var = args[0].c_str();
const char* file = args[1].c_str();
std::string const& var = args[0];
std::string const& file = args[1];
cmSourceFile* sf = this->Makefile->GetSource(file);
// for the location we must create a source file first
......
......@@ -22,8 +22,8 @@ bool cmGetTargetPropertyCommand::InitialPass(
this->SetError("called with incorrect number of arguments");
return false;
}
std::string var = args[0];
const std::string& targetName = args[1];
std::string const& var = args[0];
std::string const& targetName = args[1];
std::string prop;
bool prop_exists = false;
......
......@@ -16,8 +16,8 @@ bool cmGetTestPropertyCommand::InitialPass(
return false;
}
std::string testName = args[0];
std::string var = args[2];
std::string const& testName = args[0];
std::string const& var = args[2];
cmTest* test = this->Makefile->GetTest(testName);
if (test) {
const char* prop = CM_NULLPTR;
......
......@@ -101,7 +101,7 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
std::set<std::string> files;
std::string tmp;
std::vector<std::string> hdrExts =
std::vector<std::string> const& hdrExts =
this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
for (std::vector<cmLocalGenerator*>::const_iterator it = lgs.begin();
......
......@@ -75,29 +75,31 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
this->DefaultComponentName = "Unspecified";
}
std::string const& mode = args[0];
// Switch among the command modes.
if (args[0] == "SCRIPT") {
if (mode == "SCRIPT") {
return this->HandleScriptMode(args);
}
if (args[0] == "CODE") {
if (mode == "CODE") {
return this->HandleScriptMode(args);
}
if (args[0] == "TARGETS") {
if (mode == "TARGETS") {
return this->HandleTargetsMode(args);
}
if (args[0] == "FILES") {
if (mode == "FILES") {
return this->HandleFilesMode(args);
}
if (args[0] == "PROGRAMS") {
if (mode == "PROGRAMS") {
return this->HandleFilesMode(args);
}
if (args[0] == "DIRECTORY") {
if (mode == "DIRECTORY") {
return this->HandleDirectoryMode(args);
}
if (args[0] == "EXPORT") {
if (mode == "EXPORT") {
return this->HandleExportMode(args);
}
if (args[0] == "EXPORT_ANDROID_MK") {
if (mode == "EXPORT_ANDROID_MK") {
return this->HandleExportAndroidMKMode(args);
}
......@@ -165,7 +167,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
script.c_str(), false, component.c_str(), exclude_from_all));
} else if (doing_code) {
doing_code = false;
std::string code = args[i];
std::string const& code = args[i];
this->Makefile->AddInstallGenerator(new cmInstallScriptGenerator(
code.c_str(), true, component.c_str(), exclude_from_all));
}
......
......@@ -54,7 +54,7 @@ void cmInstallFilesCommand::FinalPass()
}
std::string testf;
std::string ext = this->FinalArgs[0];
std::string const& ext = this->FinalArgs[0];
// two different options
if (this->FinalArgs.size() > 1) {
......@@ -64,7 +64,7 @@ void cmInstallFilesCommand::FinalPass()
// for each argument, get the files
for (; s != this->FinalArgs.end(); ++s) {
// replace any variables
std::string temps = *s;
std::string const& temps = *s;
if (!cmSystemTools::GetFilenamePath(temps).empty()) {
testf = cmSystemTools::GetFilenamePath(temps) + "/" +
cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext;
......@@ -78,7 +78,7 @@ void cmInstallFilesCommand::FinalPass()
} else // reg exp list
{
std::vector<std::string> files;
std::string regex = this->FinalArgs[0];
std::string const& regex = this->FinalArgs[0];
cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(), regex,
files);
......
......@@ -2258,7 +2258,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
{
// Construct the object file name using the full path to the source
// file which is its only unique identification.
const char* fullPath = source.GetFullPath().c_str();
std::string const& fullPath = source.GetFullPath();
// Try referencing the source relative to the source tree.
std::string relFromSource =
......
......@@ -213,7 +213,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
std::vector<std::string> pools;
cmSystemTools::ExpandListArgument(jobpools, pools);
for (size_t i = 0; i < pools.size(); ++i) {
const std::string pool = pools[i];
std::string const& pool = pools[i];
const std::string::size_type eq = pool.find('=');
unsigned int jobs;
if (eq != std::string::npos &&
......
......@@ -30,7 +30,7 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args,
i = 1;
}
for (; i < args.size(); ++i) {
std::string variable = args[i];
std::string const& variable = args[i];
cmState* state = this->Makefile->GetState();
if (!state->GetCacheEntryValue(variable)) {
this->Makefile->GetCMakeInstance()->AddCacheEntry(
......
......@@ -23,7 +23,7 @@ bool cmNewLineStyle::ReadFromArguments(const std::vector<std::string>& args,
if (args[i] == "NEWLINE_STYLE") {
size_t const styleIndex = i + 1;
if (args.size() > styleIndex) {
const std::string eol = args[styleIndex];
std::string const& eol = args[styleIndex];
if (eol == "LF" || eol == "UNIX") {
NewLineStyle = LF;
return true;
......
......@@ -22,11 +22,14 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
this->SetError("PROJECT called with incorrect number of arguments");
return false;
}
this->Makefile->SetProjectName(args[0]);
std::string bindir = args[0];
std::string const& projectName = args[0];
this->Makefile->SetProjectName(projectName);
std::string bindir = projectName;
bindir += "_BINARY_DIR";
std::string srcdir = args[0];
std::string srcdir = projectName;
srcdir += "_SOURCE_DIR";
this->Makefile->AddCacheDefinition(
......@@ -44,7 +47,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->AddDefinition(srcdir,
this->Makefile->GetCurrentSourceDirectory());
this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str());
this->Makefile->AddDefinition("PROJECT_NAME", projectName.c_str());
// Set the CMAKE_PROJECT_NAME variable to be the highest-level
// project name in the tree. If there are two project commands
......@@ -54,10 +57,10 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
// will work.
if (!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME") ||
(this->Makefile->IsRootMakefile())) {
this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str());
this->Makefile->AddCacheDefinition("CMAKE_PROJECT_NAME", args[0].c_str(),
"Value Computed by CMake",
cmStateEnums::STATIC);
this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", projectName.c_str());
this->Makefile->AddCacheDefinition(
"CMAKE_PROJECT_NAME", projectName.c_str(), "Value Computed by CMake",
cmStateEnums::STATIC);
}
bool haveVersion = false;
......@@ -163,19 +166,19 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
}
std::string vv;
vv = args[0] + "_VERSION";
vv = projectName + "_VERSION";
this->Makefile->AddDefinition("PROJECT_VERSION", vs.c_str());
this->Makefile->AddDefinition(vv, vs.c_str());
vv = args[0] + "_VERSION_MAJOR";
vv = projectName + "_VERSION_MAJOR";
this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR", vb[0]);
this->Makefile->AddDefinition(vv, vb[0]);
vv = args[0] + "_VERSION_MINOR";
vv = projectName + "_VERSION_MINOR";
this->Makefile->AddDefinition("PROJECT_VERSION_MINOR", vb[1]);
this->Makefile->AddDefinition(vv, vb[1]);
vv = args[0] + "_VERSION_PATCH";
vv = projectName + "_VERSION_PATCH";
this->Makefile->AddDefinition("PROJECT_VERSION_PATCH", vb[2]);
this->Makefile->AddDefinition(vv, vb[2]);
vv = args[0] + "_VERSION_TWEAK";
vv = projectName + "_VERSION_TWEAK";
this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", vb[3]);
this->Makefile->AddDefinition(vv, vb[3]);
} else if (cmp0048 != cmPolicies::OLD) {
......@@ -186,11 +189,11 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
vv.push_back("PROJECT_VERSION_MINOR");
vv.push_back("PROJECT_VERSION_PATCH");
vv.push_back("PROJECT_VERSION_TWEAK");
vv.push_back(args[0] + "_VERSION");
vv.push_back(args[0] + "_VERSION_MAJOR");
vv.push_back(args[0] + "_VERSION_MINOR");
vv.push_back(args[0] + "_VERSION_PATCH");
vv.push_back(args[0] + "_VERSION_TWEAK");
vv.push_back(projectName + "_VERSION");
vv.push_back(projectName + "_VERSION_MAJOR");
vv.push_back(projectName + "_VERSION_MINOR");
vv.push_back(projectName + "_VERSION_PATCH");
vv.push_back(projectName + "_VERSION_TWEAK");
std::string vw;
for (std::vector<std::string>::iterator i = vv.begin(); i != vv.end();
++i) {
......@@ -234,7 +237,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
languages.push_back("CXX");
}
this->Makefile->EnableLanguage(languages, false);
std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE";
std::string extraInclude = "CMAKE_PROJECT_" + projectName + "_INCLUDE";
const char* include = this->Makefile->GetDefinition(extraInclude);
if (include) {
bool readit = this->Makefile->ReadDependentFile(include);
......
......@@ -755,7 +755,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
fileIt != srcFiles.end(); ++fileIt) {
cmSourceFile* sf = *fileIt;
if (!PropertyEnabled(sf, "SKIP_AUTOGEN")) {
const std::string ext = sf->GetExtension();
std::string const& ext = sf->GetExtension();
// Add generated file that will be scanned by moc or uic to
// the dependencies
if (mocEnabled || uicEnabled) {
......
......@@ -15,7 +15,7 @@ bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args,
return true;
}
const char* variable = args[0].c_str(); // VAR is always first
std::string const& variable = args[0]; // VAR is always first
// get the old value
const char* cacheValue = this->Makefile->GetDefinition(variable);
......
......@@ -138,7 +138,7 @@ bool cmSetPropertyCommand::HandleGlobalMode()
// Set or append the property.
cmake* cm = this->Makefile->GetCMakeInstance();
const char* name = this->PropertyName.c_str();
std::string const& name = this->PropertyName;
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
value = CM_NULLPTR;
......@@ -188,7 +188,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
}
// Set or append the property.
const char* name = this->PropertyName.c_str();
std::string const& name = this->PropertyName;
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
value = CM_NULLPTR;
......@@ -229,7 +229,7 @@ bool cmSetPropertyCommand::HandleTargetMode()
bool cmSetPropertyCommand::HandleTarget(cmTarget* target)
{
// Set or append the property.
const char* name = this->PropertyName.c_str();
std::string const& name = this->PropertyName;
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
value = CM_NULLPTR;
......@@ -268,7 +268,7 @@ bool cmSetPropertyCommand::HandleSourceMode()
bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf)
{
// Set or append the property.
const char* name = this->PropertyName.c_str();
std::string const& name = this->PropertyName;
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
value = CM_NULLPTR;
......@@ -316,7 +316,7 @@ bool cmSetPropertyCommand::HandleTestMode()
bool cmSetPropertyCommand::HandleTest(cmTest* test)
{
// Set or append the property.
const char* name = this->PropertyName.c_str();
std::string const& name = this->PropertyName;
const char* value = this->PropertyValue.c_str();
if (this->Remove) {
value = CM_NULLPTR;
......@@ -383,7 +383,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey)
{
// Set or append the property.
const char* name = this->PropertyName.c_str();
std::string const& name = this->PropertyName;
const char* value = this->PropertyValue.c_str();
cmState* state = this->Makefile->GetState();
if (this->Remove) {
......
......@@ -128,7 +128,7 @@ bool cmStringCommand::HandleToUpperLowerCommand(
return false;
}
std::string outvar = args[2];
std::string const& outvar = args[2];
std::string output;
if (toUpper) {
......@@ -149,7 +149,7 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args)
return false;
}
std::string::size_type cc;
std::string outvar = args[args.size() - 1];
std::string const& outvar = args[args.size() - 1];
std::string output;
for (cc = 1; cc < args.size() - 1; cc++) {
int ch = atoi(args[cc].c_str());
......@@ -212,7 +212,7 @@ bool cmStringCommand::HandleRegexCommand(std::vector<std::string> const& args)
this->SetError("sub-command REGEX requires a mode to be specified.");
return false;
}
std::string mode = args[1];
std::string const& mode = args[1];
if (mode == "MATCH") {
if (args.size() < 5) {
this->SetError("sub-command REGEX, mode MATCH needs "
......@@ -247,8 +247,8 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
{
//"STRING(REGEX MATCH <regular_expression> <output variable>
// <input> [<input>...])\n";
std::string regex = args[2];
std::string outvar = args[3];
std::string const& regex = args[2];
std::string const& outvar = args[3];
this->Makefile->ClearMatches();
// Compile the regular expression.
......@@ -288,8 +288,8 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
{
//"STRING(REGEX MATCHALL <regular_expression> <output variable> <input>
// [<input>...])\n";
std::string regex = args[2];
std::string outvar = args[3];
std::string const& regex = args[2];
std::string const& outvar = args[3];
this->Makefile->ClearMatches();
// Compile the regular expression.
......@@ -334,9 +334,9 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
{
//"STRING(REGEX REPLACE <regular_expression> <replace_expression>
// <output variable> <input> [<input>...])\n"
std::string regex = args[2];
std::string replace = args[3];
std::string outvar = args[4];
std::string const& regex = args[2];
std::string const& replace = args[3];
std::string const& outvar = args[4];
// Pull apart the replace expression to find the escaped [0-9] values.
std::vector<RegexReplacement> replacement;
......@@ -502,7 +502,7 @@ bool cmStringCommand::HandleCompareCommand(
this->SetError("sub-command COMPARE requires a mode to be specified.");
return false;
}
std::string mode = args[1];
std::string const& mode = args[1];
if ((mode == "EQUAL") || (mode == "NOTEQUAL") || (mode == "LESS") ||
(mode == "LESS_EQUAL") || (mode == "GREATER") ||
(mode == "GREATER_EQUAL")) {
......
......@@ -78,7 +78,7 @@ bool cmTargetPropCommandBase::ProcessContentArgs(
std::vector<std::string> const& args, unsigned int& argIndex, bool prepend,
bool system)
{
const std::string scope = args[argIndex];
std::string const& scope = args[argIndex];
if (scope != "PUBLIC" && scope != "PRIVATE" && scope != "INTERFACE") {
this->SetError("called with invalid arguments");
......
......@@ -23,7 +23,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
std::vector<std::string>::const_iterator arg = args.begin();
// The first argument is the cache entry name.