diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Source/cmNinjaUtilityTargetGenerator.cxx | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Source/cmNinjaUtilityTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaUtilityTargetGenerator.cxx | 96 |
1 files changed, 46 insertions, 50 deletions
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 735730e..b0b1147 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -20,10 +20,14 @@ #include "cmSourceFile.h" cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator( - cmGeneratorTarget *target) - : cmNinjaTargetGenerator(target) {} + cmGeneratorTarget* target) + : cmNinjaTargetGenerator(target) +{ +} -cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() {} +cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() +{ +} void cmNinjaUtilityTargetGenerator::Generate() { @@ -33,7 +37,7 @@ void cmNinjaUtilityTargetGenerator::Generate() std::vector<std::string> commands; cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName); - const std::vector<cmCustomCommand> *cmdLists[2] = { + const std::vector<cmCustomCommand>* cmdLists[2] = { &this->GetGeneratorTarget()->GetPreBuildCommands(), &this->GetGeneratorTarget()->GetPostBuildCommands() }; @@ -41,8 +45,9 @@ void cmNinjaUtilityTargetGenerator::Generate() bool uses_terminal = false; for (unsigned i = 0; i != 2; ++i) { - for (std::vector<cmCustomCommand>::const_iterator - ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) { + for (std::vector<cmCustomCommand>::const_iterator ci = + cmdLists[i]->begin(); + ci != cmdLists[i]->end(); ++ci) { cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), this->GetLocalGenerator()); this->GetLocalGenerator()->AppendCustomCommandDeps(ccg, deps); @@ -56,18 +61,16 @@ void cmNinjaUtilityTargetGenerator::Generate() } std::vector<cmSourceFile*> sources; - std::string config = this->GetMakefile() - ->GetSafeDefinition("CMAKE_BUILD_TYPE"); + std::string config = + this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->GetGeneratorTarget()->GetSourceFiles(sources, config); - for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); - source != sources.end(); ++source) - { - if(cmCustomCommand* cc = (*source)->GetCustomCommand()) - { + for (std::vector<cmSourceFile*>::const_iterator source = sources.begin(); + source != sources.end(); ++source) { + if (cmCustomCommand* cc = (*source)->GetCustomCommand()) { cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->GetLocalGenerator()); - this->GetLocalGenerator()->AddCustomCommandTarget(cc, - this->GetGeneratorTarget()); + this->GetLocalGenerator()->AddCustomCommandTarget( + cc, this->GetGeneratorTarget()); // Depend on all custom command outputs. const std::vector<std::string>& ccOutputs = ccg.GetOutputs(); @@ -76,8 +79,8 @@ void cmNinjaUtilityTargetGenerator::Generate() std::back_inserter(deps), MapToNinjaPath()); std::transform(ccByproducts.begin(), ccByproducts.end(), std::back_inserter(deps), MapToNinjaPath()); - } } + } this->GetLocalGenerator()->AppendTargetOutputs(this->GetGeneratorTarget(), outputs); @@ -85,16 +88,14 @@ void cmNinjaUtilityTargetGenerator::Generate() deps); if (commands.empty()) { - this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(), - "Utility command for " - + this->GetTargetName(), - outputs, - deps); + this->GetGlobalGenerator()->WritePhonyBuild( + this->GetBuildFileStream(), + "Utility command for " + this->GetTargetName(), outputs, deps); } else { std::string command = this->GetLocalGenerator()->BuildCommandLine(commands); - const char *echoStr = - this->GetGeneratorTarget()->GetProperty("EchoString"); + const char* echoStr = + this->GetGeneratorTarget()->GetProperty("EchoString"); std::string desc; if (echoStr) desc = echoStr; @@ -104,43 +105,38 @@ void cmNinjaUtilityTargetGenerator::Generate() // TODO: fix problematic global targets. For now, search and replace the // makefile vars. cmSystemTools::ReplaceString( - command, - "$(CMAKE_SOURCE_DIR)", - this->GetLocalGenerator()->ConvertToOutputFormat( - this->GetLocalGenerator()->GetSourceDirectory(), - cmLocalGenerator::SHELL).c_str()); + command, "$(CMAKE_SOURCE_DIR)", + this->GetLocalGenerator() + ->ConvertToOutputFormat( + this->GetLocalGenerator()->GetSourceDirectory(), + cmLocalGenerator::SHELL) + .c_str()); cmSystemTools::ReplaceString( - command, - "$(CMAKE_BINARY_DIR)", - this->GetLocalGenerator()->ConvertToOutputFormat( - this->GetLocalGenerator()->GetBinaryDirectory(), - cmLocalGenerator::SHELL).c_str()); + command, "$(CMAKE_BINARY_DIR)", + this->GetLocalGenerator() + ->ConvertToOutputFormat( + this->GetLocalGenerator()->GetBinaryDirectory(), + cmLocalGenerator::SHELL) + .c_str()); cmSystemTools::ReplaceString(command, "$(ARGS)", ""); if (command.find('$') != std::string::npos) return; - for (cmNinjaDeps::const_iterator - oi = util_outputs.begin(), oe = util_outputs.end(); - oi != oe; ++oi) - { + for (cmNinjaDeps::const_iterator oi = util_outputs.begin(), + oe = util_outputs.end(); + oi != oe; ++oi) { this->GetGlobalGenerator()->SeenCustomCommandOutput(*oi); - } + } this->GetGlobalGenerator()->WriteCustomCommandBuild( - command, - desc, - "Utility command for " + this->GetTargetName(), + command, desc, "Utility command for " + this->GetTargetName(), uses_terminal, - /*restat*/true, - util_outputs, - deps); - - this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(), - "", - outputs, - cmNinjaDeps(1, utilCommandName) - ); + /*restat*/ true, util_outputs, deps); + + this->GetGlobalGenerator()->WritePhonyBuild( + this->GetBuildFileStream(), "", outputs, + cmNinjaDeps(1, utilCommandName)); } this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(), |