cmScriptGenerator: pass Indent by value

This commit is contained in:
Daniel Pfeifer 2017-04-22 00:25:01 +02:00
parent e99dd765b7
commit 7284b15f8c
14 changed files with 66 additions and 84 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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<std::string> 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<std::string> const& dirs)
{
// Write code to install the directories.

View File

@ -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<std::string> const& dirs);
cmLocalGenerator* LocalGenerator;
std::vector<std::string> Directories;

View File

@ -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}";

View File

@ -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();

View File

@ -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<std::string> 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<std::string> files;
cmGeneratorExpression ge;

View File

@ -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<std::string> const& files);
cmLocalGenerator* LocalGenerator;

View File

@ -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<std::string> 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<std::string> 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();

View File

@ -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<std::string> 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;

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;