summaryrefslogtreecommitdiffstats
path: root/Source/cmTestGenerator.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/cmTestGenerator.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-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/cmTestGenerator.cxx')
-rw-r--r--Source/cmTestGenerator.cxx115
1 files changed, 45 insertions, 70 deletions
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 42e8090..e599825 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -17,19 +17,17 @@
#include "cmSystemTools.h"
#include "cmTest.h"
-cmTestGenerator
-::cmTestGenerator(cmTest* test,
- std::vector<std::string> const& configurations):
- cmScriptGenerator("CTEST_CONFIGURATION_TYPE", configurations),
- Test(test)
+cmTestGenerator::cmTestGenerator(
+ cmTest* test, std::vector<std::string> const& configurations)
+ : cmScriptGenerator("CTEST_CONFIGURATION_TYPE", configurations)
+ , Test(test)
{
this->ActionsPerConfig = !test->GetOldStyle();
this->TestGenerated = false;
this->LG = 0;
}
-cmTestGenerator
-::~cmTestGenerator()
+cmTestGenerator::~cmTestGenerator()
{
}
@@ -48,19 +46,16 @@ void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
void cmTestGenerator::GenerateScriptActions(std::ostream& os,
Indent const& indent)
{
- if(this->ActionsPerConfig)
- {
+ if (this->ActionsPerConfig) {
// This is the per-config generation in a single-configuration
// build generator case. The superclass will call our per-config
// method.
this->cmScriptGenerator::GenerateScriptActions(os, indent);
- }
- else
- {
+ } else {
// This is an old-style test, so there is only one config.
- //assert(this->Test->GetOldStyle());
+ // assert(this->Test->GetOldStyle());
this->GenerateOldStyle(os, indent);
- }
+ }
}
void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
@@ -81,68 +76,54 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// Check whether the command executable is a target whose name is to
// be translated.
std::string exe = command[0];
- cmGeneratorTarget* target =
- this->LG->FindGeneratorTargetToUse(exe);
- if(target && target->GetType() == cmState::EXECUTABLE)
- {
+ cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(exe);
+ if (target && target->GetType() == cmState::EXECUTABLE) {
// Use the target file on disk.
exe = target->GetFullPath(config);
// Prepend with the emulator when cross compiling if required.
- const char * emulator =
- target->GetProperty("CROSSCOMPILING_EMULATOR");
- if (emulator != 0)
- {
+ const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR");
+ if (emulator != 0) {
std::vector<std::string> emulatorWithArgs;
cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
std::string emulatorExe(emulatorWithArgs[0]);
cmSystemTools::ConvertToUnixSlashes(emulatorExe);
os << cmOutputConverter::EscapeForCMake(emulatorExe) << " ";
- for(std::vector<std::string>::const_iterator ei =
- emulatorWithArgs.begin()+1;
- ei != emulatorWithArgs.end();
- ++ei)
- {
+ for (std::vector<std::string>::const_iterator ei =
+ emulatorWithArgs.begin() + 1;
+ ei != emulatorWithArgs.end(); ++ei) {
os << cmOutputConverter::EscapeForCMake(*ei) << " ";
- }
}
}
- else
- {
+ } else {
// Use the command name given.
exe = ge.Parse(exe.c_str())->Evaluate(this->LG, config);
cmSystemTools::ConvertToUnixSlashes(exe);
- }
+ }
// Generate the command line with full escapes.
os << cmOutputConverter::EscapeForCMake(exe);
- for(std::vector<std::string>::const_iterator ci = command.begin()+1;
- ci != command.end(); ++ci)
- {
+ for (std::vector<std::string>::const_iterator ci = command.begin() + 1;
+ ci != command.end(); ++ci) {
os << " " << cmOutputConverter::EscapeForCMake(
- ge.Parse(*ci)->Evaluate(
- this->LG, config));
- }
+ ge.Parse(*ci)->Evaluate(this->LG, config));
+ }
// Finish the test command.
os << ")\n";
// Output properties for the test.
cmPropertyMap& pm = this->Test->GetProperties();
- if(!pm.empty())
- {
+ if (!pm.empty()) {
os << indent << "set_tests_properties(" << this->Test->GetName()
<< " PROPERTIES ";
- for(cmPropertyMap::const_iterator i = pm.begin();
- i != pm.end(); ++i)
- {
- os << " " << i->first
- << " " << cmOutputConverter::EscapeForCMake(
- ge.Parse(i->second.GetValue())->Evaluate(this->LG,
- config));
- }
- os << ")" << std::endl;
+ for (cmPropertyMap::const_iterator i = pm.begin(); i != pm.end(); ++i) {
+ os << " " << i->first << " "
+ << cmOutputConverter::EscapeForCMake(
+ ge.Parse(i->second.GetValue())->Evaluate(this->LG, config));
}
+ os << ")" << std::endl;
+ }
}
void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os,
@@ -153,9 +134,9 @@ void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os,
bool cmTestGenerator::NeedsScriptNoConfig() const
{
- return (this->TestGenerated && // test generated for at least one config
+ return (this->TestGenerated && // test generated for at least one config
this->ActionsPerConfig && // test is config-aware
- this->Configurations.empty() && // test runs in all configs
+ this->Configurations.empty() && // test runs in all configs
!this->ConfigurationTypes->empty()); // config-dependent command
}
@@ -173,40 +154,34 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
fout << "add_test(";
fout << this->Test->GetName() << " \"" << exe << "\"";
- for(std::vector<std::string>::const_iterator argit = command.begin()+1;
- argit != command.end(); ++argit)
- {
+ for (std::vector<std::string>::const_iterator argit = command.begin() + 1;
+ argit != command.end(); ++argit) {
// Just double-quote all arguments so they are re-parsed
// correctly by the test system.
fout << " \"";
- for(std::string::const_iterator c = argit->begin();
- c != argit->end(); ++c)
- {
+ for (std::string::const_iterator c = argit->begin(); c != argit->end();
+ ++c) {
// Escape quotes within arguments. We should escape
// backslashes too but we cannot because it makes the result
// inconsistent with previous behavior of this command.
- if((*c == '"'))
- {
+ if ((*c == '"')) {
fout << '\\';
- }
- fout << *c;
}
- fout << "\"";
+ fout << *c;
}
+ fout << "\"";
+ }
fout << ")" << std::endl;
// Output properties for the test.
cmPropertyMap& pm = this->Test->GetProperties();
- if(!pm.empty())
- {
+ if (!pm.empty()) {
fout << indent << "set_tests_properties(" << this->Test->GetName()
<< " PROPERTIES ";
- for(cmPropertyMap::const_iterator i = pm.begin();
- i != pm.end(); ++i)
- {
- fout << " " << i->first
- << " " << cmOutputConverter::EscapeForCMake(i->second.GetValue());
- }
- fout << ")" << std::endl;
+ for (cmPropertyMap::const_iterator i = pm.begin(); i != pm.end(); ++i) {
+ fout << " " << i->first << " "
+ << cmOutputConverter::EscapeForCMake(i->second.GetValue());
}
+ fout << ")" << std::endl;
+ }
}