summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-03-10 23:04:11 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-03-11 14:03:50 (GMT)
commit21c573f682f9eafbc8d4402f7febbb1bec1cb86a (patch)
tree8c9e0b913c7de5737a770430064ff5533a19477d /Source/cmLocalUnixMakefileGenerator3.cxx
parente21ffaf8fe5499426604b4ebb9cd08798ee6107c (diff)
downloadCMake-21c573f682f9eafbc8d4402f7febbb1bec1cb86a.zip
CMake-21c573f682f9eafbc8d4402f7febbb1bec1cb86a.tar.gz
CMake-21c573f682f9eafbc8d4402f7febbb1bec1cb86a.tar.bz2
Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx92
1 files changed, 46 insertions, 46 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index f7088c2..5dd2bb1 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -339,7 +339,7 @@ cmLocalUnixMakefileGenerator3
depends.push_back(output);
std::vector<std::string> no_commands;
this->WriteMakeRule(ruleFileStream, 0,
- outNoExt.c_str(), depends, no_commands, true, true);
+ outNoExt, depends, no_commands, true, true);
inHelp = false;
}
@@ -355,7 +355,7 @@ cmLocalUnixMakefileGenerator3
targetName += "/";
targetName += output;
commands.push_back(
- this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName.c_str())
+ this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName)
);
}
this->CreateCDCommand(commands,
@@ -407,12 +407,12 @@ void cmLocalUnixMakefileGenerator3
std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash();
makefile2 += "Makefile2";
commands.push_back(this->GetRecursiveMakeCall
- (makefile2.c_str(),localName.c_str()));
+ (makefile2.c_str(),localName));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
- localName.c_str(), depends, commands, true);
+ localName, depends, commands, true);
// Add a target with the canonical name (no prefix, suffix or path).
if(localName != t->second->GetName())
@@ -436,17 +436,17 @@ void cmLocalUnixMakefileGenerator3
depends.clear();
commands.clear();
commands.push_back(this->GetRecursiveMakeCall
- (makefileName.c_str(), makeTargetName.c_str()));
+ (makefileName.c_str(), makeTargetName));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
- localName.c_str(), depends, commands, true);
+ localName, depends, commands, true);
// Add a local name for the rule to relink the target before
// installation.
if(t->second->Target
- ->NeedRelinkBeforeInstall(this->ConfigurationName.c_str()))
+ ->NeedRelinkBeforeInstall(this->ConfigurationName))
{
makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/preinstall";
@@ -455,13 +455,13 @@ void cmLocalUnixMakefileGenerator3
depends.clear();
commands.clear();
commands.push_back(this->GetRecursiveMakeCall
- (makefile2.c_str(), makeTargetName.c_str()));
+ (makefile2.c_str(), makeTargetName));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream,
"Manual pre-install relink rule for target.",
- localName.c_str(), depends, commands, true);
+ localName, depends, commands, true);
}
}
}
@@ -582,7 +582,7 @@ cmLocalUnixMakefileGenerator3
// Construct the left hand side of the rule.
replace = target;
- std::string tgt = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE);
+ std::string tgt = this->Convert(replace,HOME_OUTPUT,MAKEFILE);
const char* space = "";
if(tgt.size() == 1)
{
@@ -615,7 +615,7 @@ cmLocalUnixMakefileGenerator3
dep != depends.end(); ++dep)
{
replace = *dep;
- replace = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE);
+ replace = this->Convert(replace,HOME_OUTPUT,MAKEFILE);
os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
@@ -654,10 +654,10 @@ cmLocalUnixMakefileGenerator3
std::string scmd;
if(cmSystemTools::GetShortPath(cmd.c_str(), scmd))
{
- return this->Convert(scmd.c_str(), NONE, SHELL);
+ return this->Convert(scmd, NONE, SHELL);
}
}
- return this->Convert(cmd.c_str(), root, SHELL);
+ return this->Convert(cmd, root, SHELL);
}
//----------------------------------------------------------------------------
@@ -829,7 +829,7 @@ void cmLocalUnixMakefileGenerator3
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
- runRule += this->Convert(cmakefileName.c_str(),NONE,SHELL);
+ runRule += this->Convert(cmakefileName,NONE,SHELL);
runRule += " 0";
std::vector<std::string> no_depends;
@@ -886,7 +886,7 @@ cmLocalUnixMakefileGenerator3
{
std::string dir = this->HomeRelativeOutputPath;
dir += this->GetTargetDirectory(target);
- return this->Convert(dir.c_str(),NONE,UNCHANGED);
+ return this->Convert(dir,NONE,UNCHANGED);
}
@@ -962,7 +962,7 @@ cmLocalUnixMakefileGenerator3
{
// Lookup the real name of the dependency in case it is a CMake target.
std::string dep;
- if(this->GetRealDependency(d->c_str(), this->ConfigurationName.c_str(),
+ if(this->GetRealDependency(*d, this->ConfigurationName,
dep))
{
depends.push_back(dep);
@@ -1020,7 +1020,7 @@ cmLocalUnixMakefileGenerator3
{
*content << dir;
}
- cmCustomCommandGenerator ccg(cc, this->ConfigurationName.c_str(),
+ cmCustomCommandGenerator ccg(cc, this->ConfigurationName,
this->Makefile);
// Add each command line to the set of commands.
@@ -1055,7 +1055,7 @@ cmLocalUnixMakefileGenerator3
bool had_slash = cmd.find("/") != cmd.npos;
if(!workingDir)
{
- cmd = this->Convert(cmd.c_str(),START_OUTPUT);
+ cmd = this->Convert(cmd,START_OUTPUT);
}
bool has_slash = cmd.find("/") != cmd.npos;
if(had_slash && !has_slash)
@@ -1141,7 +1141,7 @@ cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc,
const std::vector<std::string>& outputs = cc.GetOutputs();
if(!outputs.empty())
{
- output = this->Convert(outputs[0].c_str(), relative, SHELL);
+ output = this->Convert(outputs[0], relative, SHELL);
}
vars.Output = output.c_str();
@@ -1171,7 +1171,7 @@ cmLocalUnixMakefileGenerator3
cleanfile += filename;
}
cleanfile += ".cmake";
- std::string cleanfilePath = this->Convert(cleanfile.c_str(), FULL);
+ std::string cleanfilePath = this->Convert(cleanfile, FULL);
cmsys::ofstream fout(cleanfilePath.c_str());
if(!fout)
{
@@ -1183,13 +1183,13 @@ cmLocalUnixMakefileGenerator3
for(std::vector<std::string>::const_iterator f = files.begin();
f != files.end(); ++f)
{
- std::string fc = this->Convert(f->c_str(),START_OUTPUT,UNCHANGED);
- fout << " " << this->EscapeForCMake(fc.c_str()) << "\n";
+ std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED);
+ fout << " " << this->EscapeForCMake(fc) << "\n";
}
fout << ")\n";
}
std::string remove = "$(CMAKE_COMMAND) -P ";
- remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL);
+ remove += this->Convert(cleanfile, START_OUTPUT, SHELL);
commands.push_back(remove);
// For the main clean rule add per-language cleaning.
@@ -1267,14 +1267,14 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
{
// Use the native echo command.
cmd = "@echo ";
- cmd += this->EscapeForShell(line.c_str(), false, true);
+ cmd += this->EscapeForShell(line, false, true);
}
else
{
// Use cmake to echo the text in color.
cmd = "@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) ";
cmd += color_name;
- cmd += this->EscapeForShell(line.c_str());
+ cmd += this->EscapeForShell(line);
}
commands.push_back(cmd);
}
@@ -1588,14 +1588,14 @@ cmLocalUnixMakefileGenerator3
langs.begin(); li != langs.end(); ++li)
{
// construct the checker
- std::string lang = li->c_str();
+ std::string lang = *li;
// Create the scanner for this language
cmDepends *scanner = 0;
if(lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM")
{
// TODO: Handle RC (resource files) dependencies correctly.
- scanner = new cmDependsC(this, targetDir, lang.c_str(), &validDeps);
+ scanner = new cmDependsC(this, targetDir, lang, &validDeps);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
else if(lang == "Fortran")
@@ -1613,7 +1613,7 @@ cmLocalUnixMakefileGenerator3
scanner->SetLocalGenerator(this);
scanner->SetFileComparison
(this->GlobalGenerator->GetCMakeInstance()->GetFileComparison());
- scanner->SetLanguage(lang.c_str());
+ scanner->SetLanguage(lang);
scanner->SetTargetDirectory(dir.c_str());
scanner->Write(ruleFileStream, internalRuleFileStream);
@@ -1726,7 +1726,7 @@ void cmLocalUnixMakefileGenerator3
dit != glIt->second.GetUtilities().end();
++ dit )
{
- depends.push_back(dit->c_str());
+ depends.push_back(*dit);
}
this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal);
@@ -1746,7 +1746,7 @@ void cmLocalUnixMakefileGenerator3
cmLocalGenerator::START_OUTPUT);
std::string targetName = glIt->second.GetName();
this->WriteMakeRule(ruleFileStream, targetString.c_str(),
- targetName.c_str(), depends, commands, true);
+ targetName, depends, commands, true);
// Provide a "/fast" version of the target.
depends.clear();
@@ -1766,7 +1766,7 @@ void cmLocalUnixMakefileGenerator3
}
targetName += "/fast";
this->WriteMakeRule(ruleFileStream, targetString.c_str(),
- targetName.c_str(), depends, commands, true);
+ targetName, depends, commands, true);
}
}
@@ -1786,15 +1786,15 @@ void cmLocalUnixMakefileGenerator3
cmOStringStream progCmd;
progCmd <<
"$(CMAKE_COMMAND) -E cmake_progress_start ";
- progCmd << this->Convert(progressDir.c_str(),
+ progCmd << this->Convert(progressDir,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
std::string progressFile = cmake::GetCMakeFilesDirectory();
progressFile += "/progress.marks";
std::string progressFileNameFull =
- this->ConvertToFullPath(progressFile.c_str());
- progCmd << " " << this->Convert(progressFileNameFull.c_str(),
+ this->ConvertToFullPath(progressFile);
+ progCmd << " " << this->Convert(progressFileNameFull,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
commands.push_back(progCmd.str());
@@ -1802,14 +1802,14 @@ void cmLocalUnixMakefileGenerator3
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
mf2Dir += "Makefile2";
commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
- recursiveTarget.c_str()));
+ recursiveTarget));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
{
cmOStringStream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
- progCmd << this->Convert(progressDir.c_str(),
+ progCmd << this->Convert(progressDir,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
progCmd << " 0";
@@ -1824,7 +1824,7 @@ void cmLocalUnixMakefileGenerator3
commands.clear();
depends.clear();
commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
- recursiveTarget.c_str()));
+ recursiveTarget));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
@@ -1854,7 +1854,7 @@ void cmLocalUnixMakefileGenerator3
depends.push_back("cmake_check_build_system");
}
commands.push_back
- (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget.c_str()));
+ (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
@@ -1872,7 +1872,7 @@ void cmLocalUnixMakefileGenerator3
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
- runRule += this->Convert(cmakefileName.c_str(),cmLocalGenerator::NONE,
+ runRule += this->Convert(cmakefileName,cmLocalGenerator::NONE,
cmLocalGenerator::SHELL);
runRule += " 1";
commands.push_back(runRule);
@@ -1905,7 +1905,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
for(std::vector<std::string>::iterator l = files.begin();
l != files.end(); ++l)
{
- std::string dir = cmSystemTools::GetFilenamePath(l->c_str());
+ std::string dir = cmSystemTools::GetFilenamePath(*l);
// Clear the implicit dependency makefile.
std::string dependFile = dir + "/depend.make";
@@ -1964,7 +1964,7 @@ void cmLocalUnixMakefileGenerator3
std::string cidVar = "CMAKE_";
cidVar += l->first;
cidVar += "_COMPILER_ID";
- const char* cid = this->Makefile->GetDefinition(cidVar.c_str());
+ const char* cid = this->Makefile->GetDefinition(cidVar);
if(cid && *cid)
{
cmakefileStream
@@ -1976,7 +1976,7 @@ void cmLocalUnixMakefileGenerator3
// Build a list of preprocessor definitions for the target.
std::set<std::string> defines;
this->AddCompileDefinitions(defines, &target,
- this->ConfigurationName.c_str());
+ this->ConfigurationName);
if(!defines.empty())
{
cmakefileStream
@@ -1987,7 +1987,7 @@ void cmLocalUnixMakefileGenerator3
di != defines.end(); ++di)
{
cmakefileStream
- << " " << this->EscapeForCMake(di->c_str()) << "\n";
+ << " " << this->EscapeForCMake(*di) << "\n";
}
cmakefileStream
<< " )\n";
@@ -2013,7 +2013,7 @@ void cmLocalUnixMakefileGenerator3
for(std::vector<std::string>::const_iterator tri = transformRules.begin();
tri != transformRules.end(); ++tri)
{
- cmakefileStream << " " << this->EscapeForCMake(tri->c_str()) << "\n";
+ cmakefileStream << " " << this->EscapeForCMake(*tri) << "\n";
}
cmakefileStream
<< " )\n";
@@ -2070,12 +2070,12 @@ cmLocalUnixMakefileGenerator3
// Escape one extra time if the make tool requires it.
if(this->MakeCommandEscapeTargetTwice)
{
- tgt2 = this->EscapeForShell(tgt2.c_str(), true, false);
+ tgt2 = this->EscapeForShell(tgt2, true, false);
}
// The target name is now a string that should be passed verbatim
// on the command line.
- cmd += this->EscapeForShell(tgt2.c_str(), true, false);
+ cmd += this->EscapeForShell(tgt2, true, false);
}
return cmd;
}