From 7284b15f8c9bb20618e5286b41ff2f13245dfb9c Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sat, 22 Apr 2017 00:25:01 +0200 Subject: cmScriptGenerator: pass Indent by value --- Source/cmCPackPropertiesGenerator.cxx | 2 +- Source/cmCPackPropertiesGenerator.h | 2 +- Source/cmInstallDirectoryGenerator.cxx | 6 +++--- Source/cmInstallDirectoryGenerator.h | 7 +++---- Source/cmInstallExportGenerator.cxx | 4 ++-- Source/cmInstallExportGenerator.h | 6 ++---- Source/cmInstallFilesGenerator.cxx | 6 +++--- Source/cmInstallFilesGenerator.h | 7 +++---- Source/cmInstallTargetGenerator.cxx | 26 ++++++++++++-------------- Source/cmInstallTargetGenerator.h | 31 ++++++++++++++----------------- Source/cmScriptGenerator.cxx | 12 +++++------- Source/cmScriptGenerator.h | 14 +++++++------- Source/cmTestGenerator.cxx | 14 +++++--------- Source/cmTestGenerator.h | 13 +++++-------- 14 files changed, 66 insertions(+), 84 deletions(-) diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx index ae6b0a1..57a8b38 100644 --- a/Source/cmCPackPropertiesGenerator.cxx +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -19,7 +19,7 @@ cmCPackPropertiesGenerator::cmCPackPropertiesGenerator( } void cmCPackPropertiesGenerator::GenerateScriptForConfig( - std::ostream& os, const std::string& config, Indent const& indent) + std::ostream& os, const std::string& config, Indent indent) { std::string const& expandedFileName = this->InstalledFile.GetNameExpression().Evaluate(this->LG, config); diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h index 6df5297..107ccf9 100644 --- a/Source/cmCPackPropertiesGenerator.h +++ b/Source/cmCPackPropertiesGenerator.h @@ -27,7 +27,7 @@ public: protected: void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent const& indent) CM_OVERRIDE; + Indent indent) CM_OVERRIDE; cmLocalGenerator* LG; cmInstalledFile const& InstalledFile; diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index dfb3aeb..54ad85c 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -48,7 +48,7 @@ void cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg) } void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, - Indent const& indent) + Indent indent) { if (this->ActionsPerConfig) { this->cmInstallGenerator::GenerateScriptActions(os, indent); @@ -58,7 +58,7 @@ void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, } void cmInstallDirectoryGenerator::GenerateScriptForConfig( - std::ostream& os, const std::string& config, Indent const& indent) + std::ostream& os, const std::string& config, Indent indent) { std::vector dirs; cmGeneratorExpression ge; @@ -82,7 +82,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig( } void cmInstallDirectoryGenerator::AddDirectoryInstallRule( - std::ostream& os, const std::string& config, Indent const& indent, + std::ostream& os, const std::string& config, Indent indent, std::vector const& dirs) { // Write code to install the directories. diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 029ce46..aa2cbc6 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -34,12 +34,11 @@ public: std::string GetDestination(std::string const& config) const; protected: - void GenerateScriptActions(std::ostream& os, - Indent const& indent) CM_OVERRIDE; + void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE; void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent const& indent) CM_OVERRIDE; + Indent indent) CM_OVERRIDE; void AddDirectoryInstallRule(std::ostream& os, const std::string& config, - Indent const& indent, + Indent indent, std::vector const& dirs); cmLocalGenerator* LocalGenerator; std::vector Directories; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 39fab4f..b176e85 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -166,7 +166,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) } void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, - Indent const& indent) + Indent indent) { // Create the main install rules first. this->cmInstallGenerator::GenerateScriptConfigs(os, indent); @@ -189,7 +189,7 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, } void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, - Indent const& indent) + Indent indent) { // Remove old per-configuration export files if the main changes. std::string installedDir = "$ENV{DESTDIR}"; diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 3a46a72..047e6b3 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -44,10 +44,8 @@ public: protected: void GenerateScript(std::ostream& os) CM_OVERRIDE; - void GenerateScriptConfigs(std::ostream& os, - Indent const& indent) CM_OVERRIDE; - void GenerateScriptActions(std::ostream& os, - Indent const& indent) CM_OVERRIDE; + void GenerateScriptConfigs(std::ostream& os, Indent indent) CM_OVERRIDE; + void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE; void GenerateImportFile(cmExportSet const* exportSet); void GenerateImportFile(const char* config, cmExportSet const* exportSet); void ComputeTempDir(); diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 7daea38..6323a91 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -54,7 +54,7 @@ std::string cmInstallFilesGenerator::GetDestination( } void cmInstallFilesGenerator::AddFilesInstallRule( - std::ostream& os, std::string const& config, Indent const& indent, + std::ostream& os, std::string const& config, Indent indent, std::vector const& files) { // Write code to install the files. @@ -67,7 +67,7 @@ void cmInstallFilesGenerator::AddFilesInstallRule( } void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, - Indent const& indent) + Indent indent) { if (this->ActionsPerConfig) { this->cmInstallGenerator::GenerateScriptActions(os, indent); @@ -77,7 +77,7 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, } void cmInstallFilesGenerator::GenerateScriptForConfig( - std::ostream& os, const std::string& config, Indent const& indent) + std::ostream& os, const std::string& config, Indent indent) { std::vector files; cmGeneratorExpression ge; diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 578763b..62b57f9 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -34,12 +34,11 @@ public: std::string GetDestination(std::string const& config) const; protected: - void GenerateScriptActions(std::ostream& os, - Indent const& indent) CM_OVERRIDE; + void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE; void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent const& indent) CM_OVERRIDE; + Indent indent) CM_OVERRIDE; void AddFilesInstallRule(std::ostream& os, std::string const& config, - Indent const& indent, + Indent indent, std::vector const& files); cmLocalGenerator* LocalGenerator; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 1827ed3..84d6f7a 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -58,7 +58,7 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os) } void cmInstallTargetGenerator::GenerateScriptForConfig( - std::ostream& os, const std::string& config, Indent const& indent) + std::ostream& os, const std::string& config, Indent indent) { cmStateEnums::TargetType targetType = this->Target->GetType(); cmInstallType type = cmInstallType(); @@ -339,7 +339,7 @@ static std::string computeInstallObjectDir(cmGeneratorTarget* gt, } void cmInstallTargetGenerator::GenerateScriptForConfigObjectLibrary( - std::ostream& os, const std::string& config, Indent const& indent) + std::ostream& os, const std::string& config, Indent indent) { // Compute all the object files inside this target std::vector objects; @@ -444,7 +444,7 @@ void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName); } -void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent const& indent, +void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent, const std::string& config, std::string const& file, TweakMethod tweak) @@ -460,7 +460,7 @@ void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent const& indent, } } -void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent const& indent, +void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent, const std::string& config, std::vector const& files, TweakMethod tweak) @@ -500,7 +500,7 @@ std::string cmInstallTargetGenerator::GetDestDirPath(std::string const& file) } void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os, - Indent const& indent, + Indent indent, const std::string& config, std::string const& file) { @@ -508,7 +508,7 @@ void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os, } void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, - Indent const& indent, + Indent indent, const std::string& config, std::string const& file) { @@ -520,7 +520,7 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, } void cmInstallTargetGenerator::AddInstallNamePatchRule( - std::ostream& os, Indent const& indent, const std::string& config, + std::ostream& os, Indent indent, const std::string& config, std::string const& toDestDirPath) { if (this->ImportLibrary || @@ -621,7 +621,7 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule( } void cmInstallTargetGenerator::AddRPathCheckRule( - std::ostream& os, Indent const& indent, const std::string& config, + std::ostream& os, Indent indent, const std::string& config, std::string const& toDestDirPath) { // Skip the chrpath if the target does not need it. @@ -655,7 +655,7 @@ void cmInstallTargetGenerator::AddRPathCheckRule( } void cmInstallTargetGenerator::AddChrpathPatchRule( - std::ostream& os, Indent const& indent, const std::string& config, + std::ostream& os, Indent indent, const std::string& config, std::string const& toDestDirPath) { // Skip the chrpath if the target does not need it. @@ -750,8 +750,7 @@ void cmInstallTargetGenerator::AddChrpathPatchRule( } } -void cmInstallTargetGenerator::AddStripRule(std::ostream& os, - Indent const& indent, +void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent, const std::string& toDestDirPath) { @@ -779,8 +778,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, os << indent << "endif()\n"; } -void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, - Indent const& indent, +void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, Indent indent, const std::string& toDestDirPath) { // Static libraries need ranlib on this platform. @@ -805,7 +803,7 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, } void cmInstallTargetGenerator::AddUniversalInstallRule( - std::ostream& os, Indent const& indent, const std::string& toDestDirPath) + std::ostream& os, Indent indent, const std::string& toDestDirPath) { cmMakefile const* mf = this->Target->Target->GetMakefile(); diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 6aaa3ba..cf2de58 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -67,42 +67,39 @@ public: protected: void GenerateScript(std::ostream& os) CM_OVERRIDE; void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent const& indent) CM_OVERRIDE; + Indent indent) CM_OVERRIDE; void GenerateScriptForConfigObjectLibrary(std::ostream& os, const std::string& config, - Indent const& indent); - typedef void (cmInstallTargetGenerator::*TweakMethod)(std::ostream&, - Indent const&, + Indent indent); + typedef void (cmInstallTargetGenerator::*TweakMethod)(std::ostream&, Indent, const std::string&, std::string const&); - void AddTweak(std::ostream& os, Indent const& indent, - const std::string& config, std::string const& file, - TweakMethod tweak); - void AddTweak(std::ostream& os, Indent const& indent, - const std::string& config, + void AddTweak(std::ostream& os, Indent indent, const std::string& config, + std::string const& file, TweakMethod tweak); + void AddTweak(std::ostream& os, Indent indent, const std::string& config, std::vector const& files, TweakMethod tweak); std::string GetDestDirPath(std::string const& file); - void PreReplacementTweaks(std::ostream& os, Indent const& indent, + void PreReplacementTweaks(std::ostream& os, Indent indent, const std::string& config, std::string const& file); - void PostReplacementTweaks(std::ostream& os, Indent const& indent, + void PostReplacementTweaks(std::ostream& os, Indent indent, const std::string& config, std::string const& file); - void AddInstallNamePatchRule(std::ostream& os, Indent const& indent, + void AddInstallNamePatchRule(std::ostream& os, Indent indent, const std::string& config, const std::string& toDestDirPath); - void AddChrpathPatchRule(std::ostream& os, Indent const& indent, + void AddChrpathPatchRule(std::ostream& os, Indent indent, const std::string& config, std::string const& toDestDirPath); - void AddRPathCheckRule(std::ostream& os, Indent const& indent, + void AddRPathCheckRule(std::ostream& os, Indent indent, const std::string& config, std::string const& toDestDirPath); - void AddStripRule(std::ostream& os, Indent const& indent, + void AddStripRule(std::ostream& os, Indent indent, const std::string& toDestDirPath); - void AddRanlibRule(std::ostream& os, Indent const& indent, + void AddRanlibRule(std::ostream& os, Indent indent, const std::string& toDestDirPath); - void AddUniversalInstallRule(std::ostream& os, Indent const& indent, + void AddUniversalInstallRule(std::ostream& os, Indent indent, const std::string& toDestDirPath); std::string TargetName; diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 2a2dd40..3cf2537 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -90,8 +90,7 @@ void cmScriptGenerator::GenerateScript(std::ostream& os) this->GenerateScriptConfigs(os, indent); } -void cmScriptGenerator::GenerateScriptConfigs(std::ostream& os, - Indent const& indent) +void cmScriptGenerator::GenerateScriptConfigs(std::ostream& os, Indent indent) { if (this->ActionsPerConfig) { this->GenerateScriptActionsPerConfig(os, indent); @@ -100,8 +99,7 @@ void cmScriptGenerator::GenerateScriptConfigs(std::ostream& os, } } -void cmScriptGenerator::GenerateScriptActions(std::ostream& os, - Indent const& indent) +void cmScriptGenerator::GenerateScriptActions(std::ostream& os, Indent indent) { if (this->ActionsPerConfig) { // This is reached for single-configuration build generators in a @@ -112,7 +110,7 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os, void cmScriptGenerator::GenerateScriptForConfig(std::ostream& /*unused*/, const std::string& /*unused*/, - Indent const& /*unused*/) + Indent /*unused*/) { // No actions for this generator. } @@ -138,7 +136,7 @@ bool cmScriptGenerator::GeneratesForConfig(const std::string& config) } void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os, - Indent const& indent) + Indent indent) { if (this->Configurations.empty()) { // This rule is for all configurations. @@ -153,7 +151,7 @@ void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os, } void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, - Indent const& indent) + Indent indent) { if (this->ConfigurationTypes->empty()) { // In a single-configuration generator there is only one action diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index de2b60d..4023f3e 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -35,7 +35,7 @@ private: int Level; }; inline std::ostream& operator<<(std::ostream& os, - cmScriptGeneratorIndent const& indent) + cmScriptGeneratorIndent indent) { indent.Write(os); return os; @@ -58,12 +58,12 @@ public: protected: typedef cmScriptGeneratorIndent Indent; virtual void GenerateScript(std::ostream& os); - virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); - virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); + virtual void GenerateScriptConfigs(std::ostream& os, Indent indent); + virtual void GenerateScriptActions(std::ostream& os, Indent indent); virtual void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent const& indent); - virtual void GenerateScriptNoConfig(std::ostream&, Indent const&) {} + Indent indent); + virtual void GenerateScriptNoConfig(std::ostream&, Indent) {} virtual bool NeedsScriptNoConfig() const { return false; } // Test if this generator does something for a given configuration. @@ -90,8 +90,8 @@ private: cmScriptGenerator(cmScriptGenerator const&); cmScriptGenerator& operator=(cmScriptGenerator const&); - void GenerateScriptActionsOnce(std::ostream& os, Indent const& indent); - void GenerateScriptActionsPerConfig(std::ostream& os, Indent const& indent); + void GenerateScriptActionsOnce(std::ostream& os, Indent indent); + void GenerateScriptActionsPerConfig(std::ostream& os, Indent indent); }; #endif diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 4164f3a..be4b378 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -35,15 +35,13 @@ void cmTestGenerator::Compute(cmLocalGenerator* lg) this->LG = lg; } -void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, - Indent const& indent) +void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, Indent indent) { // Create the tests. this->cmScriptGenerator::GenerateScriptConfigs(os, indent); } -void cmTestGenerator::GenerateScriptActions(std::ostream& os, - Indent const& indent) +void cmTestGenerator::GenerateScriptActions(std::ostream& os, Indent indent) { if (this->ActionsPerConfig) { // This is the per-config generation in a single-configuration @@ -59,7 +57,7 @@ void cmTestGenerator::GenerateScriptActions(std::ostream& os, void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent const& indent) + Indent indent) { this->TestGenerated = true; @@ -125,8 +123,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, } } -void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, - Indent const& indent) +void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent) { os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n"; } @@ -139,8 +136,7 @@ bool cmTestGenerator::NeedsScriptNoConfig() const !this->ConfigurationTypes->empty()); // config-dependent command } -void cmTestGenerator::GenerateOldStyle(std::ostream& fout, - Indent const& indent) +void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent) { this->TestGenerated = true; diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index 7214375..9a25e33 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -29,16 +29,13 @@ public: void Compute(cmLocalGenerator* lg); protected: - void GenerateScriptConfigs(std::ostream& os, - Indent const& indent) CM_OVERRIDE; - void GenerateScriptActions(std::ostream& os, - Indent const& indent) CM_OVERRIDE; + void GenerateScriptConfigs(std::ostream& os, Indent indent) CM_OVERRIDE; + void GenerateScriptActions(std::ostream& os, Indent indent) CM_OVERRIDE; void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent const& indent) CM_OVERRIDE; - void GenerateScriptNoConfig(std::ostream& os, - Indent const& indent) CM_OVERRIDE; + Indent indent) CM_OVERRIDE; + void GenerateScriptNoConfig(std::ostream& os, Indent indent) CM_OVERRIDE; bool NeedsScriptNoConfig() const CM_OVERRIDE; - void GenerateOldStyle(std::ostream& os, Indent const& indent); + void GenerateOldStyle(std::ostream& os, Indent indent); cmLocalGenerator* LG; cmTest* Test; -- cgit v0.12