Source: Modernize for loops, add const modifiers

This commit is contained in:
Vitaly Stakhovsky
2018-12-30 14:31:53 -05:00
parent ae8525b82f
commit 1cf9c754db
4 changed files with 23 additions and 30 deletions
+7 -8
View File
@@ -59,18 +59,17 @@ void cmExtraCodeLiteGenerator::Generate()
// and extract the information for creating the worspace // and extract the information for creating the worspace
// root makefile // root makefile
for (auto const& it : projectMap) { for (auto const& it : projectMap) {
const cmMakefile* mf = it.second[0]->GetMakefile(); cmLocalGenerator* lg = it.second[0];
const cmMakefile* mf = lg->GetMakefile();
this->ConfigName = GetConfigurationName(mf); this->ConfigName = GetConfigurationName(mf);
if (it.second[0]->GetCurrentBinaryDirectory() == if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) {
it.second[0]->GetBinaryDirectory()) { workspaceOutputDir = lg->GetCurrentBinaryDirectory();
workspaceOutputDir = it.second[0]->GetCurrentBinaryDirectory(); workspaceProjectName = lg->GetProjectName();
workspaceProjectName = it.second[0]->GetProjectName(); workspaceSourcePath = lg->GetSourceDirectory();
workspaceSourcePath = it.second[0]->GetSourceDirectory();
workspaceFileName = workspaceOutputDir + "/"; workspaceFileName = workspaceOutputDir + "/";
workspaceFileName += workspaceProjectName + ".workspace"; workspaceFileName += workspaceProjectName + ".workspace";
this->WorkspacePath = it.second[0]->GetCurrentBinaryDirectory(); this->WorkspacePath = lg->GetCurrentBinaryDirectory();
;
break; break;
} }
} }
+4 -9
View File
@@ -71,16 +71,11 @@ const std::string& cmCompiledGeneratorExpression::EvaluateWithContext(
this->Output.clear(); this->Output.clear();
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = for (const cmGeneratorExpressionEvaluator* it : this->Evaluators) {
this->Evaluators.begin(); this->Output += it->Evaluate(&context, dagChecker);
const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end =
this->Evaluators.end();
for (; it != end; ++it) { this->SeenTargetProperties.insert(context.SeenTargetProperties.cbegin(),
this->Output += (*it)->Evaluate(&context, dagChecker); context.SeenTargetProperties.cend());
this->SeenTargetProperties.insert(context.SeenTargetProperties.begin(),
context.SeenTargetProperties.end());
if (context.HadError) { if (context.HadError) {
this->Output.clear(); this->Output.clear();
break; break;
+11 -12
View File
@@ -196,7 +196,7 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string& config,
std::string outputFilename(this->GetOutputFilename(config)); std::string outputFilename(this->GetOutputFilename(config));
if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
std::string const static_library_suffix = std::string const& static_library_suffix =
this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"); this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
*this->GetFolderBuildStreams() *this->GetFolderBuildStreams()
<< " -o \"" << outputDir << outputFilename << static_library_suffix << " -o \"" << outputDir << outputFilename << static_library_suffix
@@ -478,10 +478,9 @@ void cmGhsMultiTargetGenerator::WriteSources(
std::vector<cmSourceFile*> const& objectSources, std::vector<cmSourceFile*> const& objectSources,
std::map<const cmSourceFile*, std::string> const& objectNames) std::map<const cmSourceFile*, std::string> const& objectNames)
{ {
for (std::vector<cmSourceFile*>::const_iterator si = objectSources.begin(); for (const cmSourceFile* sf : objectSources) {
si != objectSources.end(); ++si) {
std::vector<cmSourceGroup> sourceGroups(this->Makefile->GetSourceGroups()); std::vector<cmSourceGroup> sourceGroups(this->Makefile->GetSourceGroups());
std::string const& sourceFullPath = (*si)->GetFullPath(); std::string const& sourceFullPath = sf->GetFullPath();
cmSourceGroup* sourceGroup = cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups); this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups);
std::string sgPath = sourceGroup->GetFullName(); std::string sgPath = sourceGroup->GetFullName();
@@ -491,8 +490,8 @@ void cmGhsMultiTargetGenerator::WriteSources(
this->LocalGenerator->GetBinaryDirectory().c_str(), sgPath, this->LocalGenerator->GetBinaryDirectory().c_str(), sgPath,
GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath); GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath);
std::string fullSourcePath((*si)->GetFullPath()); std::string fullSourcePath(sf->GetFullPath());
if ((*si)->GetExtension() == "int" || (*si)->GetExtension() == "bsp") { if (sf->GetExtension() == "int" || sf->GetExtension() == "bsp") {
*this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl; *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
} else { } else {
// WORKAROUND: GHS MULTI needs the path to use backslashes without quotes // WORKAROUND: GHS MULTI needs the path to use backslashes without quotes
@@ -501,12 +500,12 @@ void cmGhsMultiTargetGenerator::WriteSources(
*this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl; *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
} }
if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() && if ("ld" != sf->GetExtension() && "int" != sf->GetExtension() &&
"bsp" != (*si)->GetExtension()) { "bsp" != sf->GetExtension()) {
this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si)); this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], sf);
if (objectNames.end() != objectNames.find(*si)) { if (objectNames.end() != objectNames.find(sf)) {
*this->FolderBuildStreams[sgPath] *this->FolderBuildStreams[sgPath]
<< " -o \"" << objectNames.find(*si)->second << "\"" << std::endl; << " -o \"" << objectNames.find(sf)->second << "\"" << std::endl;
} }
this->WriteObjectDir(this->FolderBuildStreams[sgPath], this->WriteObjectDir(this->FolderBuildStreams[sgPath],
@@ -516,7 +515,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
} }
void cmGhsMultiTargetGenerator::WriteObjectLangOverride( void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
cmGeneratedFileStream* fileStream, cmSourceFile* sourceFile) cmGeneratedFileStream* fileStream, const cmSourceFile* sourceFile)
{ {
const char* rawLangProp = sourceFile->GetProperty("LANGUAGE"); const char* rawLangProp = sourceFile->GetProperty("LANGUAGE");
if (NULL != rawLangProp) { if (NULL != rawLangProp) {
+1 -1
View File
@@ -86,7 +86,7 @@ private:
cmLocalGhsMultiGenerator* localGhsMultiGenerator, cmLocalGhsMultiGenerator* localGhsMultiGenerator,
cmGeneratorTarget* generatorTarget); cmGeneratorTarget* generatorTarget);
static void WriteObjectLangOverride(cmGeneratedFileStream* fileStream, static void WriteObjectLangOverride(cmGeneratedFileStream* fileStream,
cmSourceFile* sourceFile); const cmSourceFile* sourceFile);
static void WriteObjectDir(cmGeneratedFileStream* fileStream, static void WriteObjectDir(cmGeneratedFileStream* fileStream,
std::string const& dir); std::string const& dir);
std::string GetOutputDirectory(const std::string& config) const; std::string GetOutputDirectory(const std::string& config) const;