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/CTest/cmCTestBuildCommand.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/CTest/cmCTestBuildCommand.cxx')
-rw-r--r-- | Source/CTest/cmCTestBuildCommand.cxx | 145 |
1 files changed, 62 insertions, 83 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index ca3960f..05cccbf 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -17,7 +17,6 @@ #include "cmGlobalGenerator.h" #include "cmake.h" - cmCTestBuildCommand::cmCTestBuildCommand() { this->GlobalGenerator = 0; @@ -33,37 +32,31 @@ cmCTestBuildCommand::cmCTestBuildCommand() cmCTestBuildCommand::~cmCTestBuildCommand() { - if ( this->GlobalGenerator ) - { + if (this->GlobalGenerator) { delete this->GlobalGenerator; this->GlobalGenerator = 0; - } + } } cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() { - cmCTestGenericHandler* handler - = this->CTest->GetInitializedHandler("build"); - if ( !handler ) - { + cmCTestGenericHandler* handler = this->CTest->GetInitializedHandler("build"); + if (!handler) { this->SetError("internal CTest error. Cannot instantiate build handler"); return 0; - } - this->Handler = (cmCTestBuildHandler*)handler; + } + this->Handler = (cmCTestBuildHandler*)handler; - const char* ctestBuildCommand - = this->Makefile->GetDefinition("CTEST_BUILD_COMMAND"); - if ( ctestBuildCommand && *ctestBuildCommand ) - { + const char* ctestBuildCommand = + this->Makefile->GetDefinition("CTEST_BUILD_COMMAND"); + if (ctestBuildCommand && *ctestBuildCommand) { this->CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand, - this->Quiet); - } - else - { - const char* cmakeGeneratorName - = this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR"); - const char* cmakeProjectName - = (this->Values[ctb_PROJECT_NAME] && *this->Values[ctb_PROJECT_NAME]) + this->Quiet); + } else { + const char* cmakeGeneratorName = + this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR"); + const char* cmakeProjectName = + (this->Values[ctb_PROJECT_NAME] && *this->Values[ctb_PROJECT_NAME]) ? this->Values[ctb_PROJECT_NAME] : this->Makefile->GetDefinition("CTEST_PROJECT_NAME"); @@ -72,81 +65,71 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() // CTEST_CONFIGURATION_TYPE script variable, or ctest -C command // line argument... in that order. // - const char* ctestBuildConfiguration - = this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION"); - const char* cmakeBuildConfiguration - = (this->Values[ctb_CONFIGURATION] && *this->Values[ctb_CONFIGURATION]) + const char* ctestBuildConfiguration = + this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION"); + const char* cmakeBuildConfiguration = + (this->Values[ctb_CONFIGURATION] && *this->Values[ctb_CONFIGURATION]) ? this->Values[ctb_CONFIGURATION] : ((ctestBuildConfiguration && *ctestBuildConfiguration) - ? ctestBuildConfiguration - : this->CTest->GetConfigType().c_str()); + ? ctestBuildConfiguration + : this->CTest->GetConfigType().c_str()); - const char* cmakeBuildAdditionalFlags - = (this->Values[ctb_FLAGS] && *this->Values[ctb_FLAGS]) + const char* cmakeBuildAdditionalFlags = + (this->Values[ctb_FLAGS] && *this->Values[ctb_FLAGS]) ? this->Values[ctb_FLAGS] : this->Makefile->GetDefinition("CTEST_BUILD_FLAGS"); - const char* cmakeBuildTarget - = (this->Values[ctb_TARGET] && *this->Values[ctb_TARGET]) + const char* cmakeBuildTarget = + (this->Values[ctb_TARGET] && *this->Values[ctb_TARGET]) ? this->Values[ctb_TARGET] : this->Makefile->GetDefinition("CTEST_BUILD_TARGET"); - if ( cmakeGeneratorName && *cmakeGeneratorName && - cmakeProjectName && *cmakeProjectName ) - { - if ( !cmakeBuildConfiguration ) - { + if (cmakeGeneratorName && *cmakeGeneratorName && cmakeProjectName && + *cmakeProjectName) { + if (!cmakeBuildConfiguration) { cmakeBuildConfiguration = "Release"; - } - if ( this->GlobalGenerator ) - { - if ( this->GlobalGenerator->GetName() != cmakeGeneratorName ) - { + } + if (this->GlobalGenerator) { + if (this->GlobalGenerator->GetName() != cmakeGeneratorName) { delete this->GlobalGenerator; this->GlobalGenerator = 0; - } } - if ( !this->GlobalGenerator ) - { + } + if (!this->GlobalGenerator) { this->GlobalGenerator = this->Makefile->GetCMakeInstance()->CreateGlobalGenerator( cmakeGeneratorName); - if(!this->GlobalGenerator) - { + if (!this->GlobalGenerator) { std::string e = "could not create generator named \""; e += cmakeGeneratorName; e += "\""; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e); cmSystemTools::SetFatalErrorOccured(); return 0; - } } - if(strlen(cmakeBuildConfiguration) == 0) - { + } + if (strlen(cmakeBuildConfiguration) == 0) { const char* config = 0; #ifdef CMAKE_INTDIR config = CMAKE_INTDIR; #endif - if(!config) - { + if (!config) { config = "Debug"; - } - cmakeBuildConfiguration = config; } + cmakeBuildConfiguration = config; + } std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory"); - std::string buildCommand - = this->GlobalGenerator-> - GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "", - cmakeBuildConfiguration, + std::string buildCommand = + this->GlobalGenerator->GenerateCMakeBuildCommand( + cmakeBuildTarget ? cmakeBuildTarget : "", cmakeBuildConfiguration, cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", this->Makefile->IgnoreErrorsCMP0061()); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "SetMakeCommand:" << buildCommand << "\n", this->Quiet); + "SetMakeCommand:" << buildCommand << "\n", + this->Quiet); this->CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str(), - this->Quiet); - } - else - { + this->Quiet); + } else { std::ostringstream ostr; /* clang-format off */ ostr << "has no project to build. If this is a " @@ -163,39 +146,35 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() /* clang-format on */ this->SetError(ostr.str()); return 0; - } } + } - if(const char* useLaunchers = - this->Makefile->GetDefinition("CTEST_USE_LAUNCHERS")) - { + if (const char* useLaunchers = + this->Makefile->GetDefinition("CTEST_USE_LAUNCHERS")) { this->CTest->SetCTestConfiguration("UseLaunchers", useLaunchers, - this->Quiet); - } + this->Quiet); + } handler->SetQuiet(this->Quiet); return handler; } - bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus &status) + cmExecutionStatus& status) { - bool ret = cmCTestHandlerCommand::InitialPass(args, status); - if ( this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS]) - { + bool ret = cmCTestHandlerCommand::InitialPass(args, status); + if (this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS]) { std::ostringstream str; str << this->Handler->GetTotalErrors(); - this->Makefile->AddDefinition( - this->Values[ctb_NUMBER_ERRORS], str.str().c_str()); - } - if ( this->Values[ctb_NUMBER_WARNINGS] - && *this->Values[ctb_NUMBER_WARNINGS]) - { + this->Makefile->AddDefinition(this->Values[ctb_NUMBER_ERRORS], + str.str().c_str()); + } + if (this->Values[ctb_NUMBER_WARNINGS] && + *this->Values[ctb_NUMBER_WARNINGS]) { std::ostringstream str; str << this->Handler->GetTotalWarnings(); - this->Makefile->AddDefinition( - this->Values[ctb_NUMBER_WARNINGS], str.str().c_str()); - } + this->Makefile->AddDefinition(this->Values[ctb_NUMBER_WARNINGS], + str.str().c_str()); + } return ret; } |