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/cmParseArgumentsCommand.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/cmParseArgumentsCommand.cxx')
-rw-r--r-- | Source/cmParseArgumentsCommand.cxx | 128 |
1 files changed, 51 insertions, 77 deletions
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index 8d78921..8f524ec 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -15,19 +15,18 @@ #include "cmAlgorithms.h" -bool cmParseArgumentsCommand -::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) +bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, + cmExecutionStatus&) { // cmake_parse_arguments(prefix options single multi <ARGN>) // 1 2 3 4 - if (args.size() < 4) - { + if (args.size() < 4) { this->SetError("must be called with at least 4 arguments."); return false; - } + } std::vector<std::string>::const_iterator argIter = args.begin(), - argEnd = args.end(); + argEnd = args.end(); // the first argument is the prefix const std::string prefix = (*argIter++) + "_"; @@ -50,44 +49,38 @@ bool cmParseArgumentsCommand // the second argument is a (cmake) list of options without argument std::vector<std::string> list; cmSystemTools::ExpandListArgument(*argIter++, list); - for (std::vector<std::string>::const_iterator iter = list.begin(), - end = list.end(); - iter != end; ++iter) - { - if (!used_keywords.insert(*iter).second) - { + for (std::vector<std::string>::const_iterator iter = list.begin(), + end = list.end(); + iter != end; ++iter) { + if (!used_keywords.insert(*iter).second) { this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + *iter); - } - options[*iter]; // default initialize } + options[*iter]; // default initialize + } // the third argument is a (cmake) list of single argument options list.clear(); cmSystemTools::ExpandListArgument(*argIter++, list); - for (std::vector<std::string>::const_iterator iter = list.begin(), - end = list.end(); - iter != end; ++iter) - { - if (!used_keywords.insert(*iter).second) - { + for (std::vector<std::string>::const_iterator iter = list.begin(), + end = list.end(); + iter != end; ++iter) { + if (!used_keywords.insert(*iter).second) { this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + *iter); - } - single[*iter]; // default initialize } + single[*iter]; // default initialize + } // the fourth argument is a (cmake) list of multi argument options list.clear(); cmSystemTools::ExpandListArgument(*argIter++, list); - for (std::vector<std::string>::const_iterator iter = list.begin(), - end = list.end(); - iter != end; ++iter) - { - if (!used_keywords.insert(*iter).second) - { + for (std::vector<std::string>::const_iterator iter = list.begin(), + end = list.end(); + iter != end; ++iter) { + if (!used_keywords.insert(*iter).second) { this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + *iter); - } - multi[*iter]; // default initialize } + multi[*iter]; // default initialize + } enum insideValues { @@ -100,41 +93,35 @@ bool cmParseArgumentsCommand // Flatten ;-lists in the arguments into a single list as was done // by the original function(CMAKE_PARSE_ARGUMENTS). list.clear(); - for(; argIter != argEnd; ++argIter) - { + for (; argIter != argEnd; ++argIter) { cmSystemTools::ExpandListArgument(*argIter, list); - } + } // iterate over the arguments list and fill in the values where applicable - for (argIter = list.begin(), argEnd = list.end(); - argIter != argEnd; ++argIter) - { + for (argIter = list.begin(), argEnd = list.end(); argIter != argEnd; + ++argIter) { const options_map::iterator optIter = options.find(*argIter); - if (optIter != options.end()) - { + if (optIter != options.end()) { insideValues = NONE; optIter->second = true; continue; - } + } const single_map::iterator singleIter = single.find(*argIter); - if (singleIter != single.end()) - { + if (singleIter != single.end()) { insideValues = SINGLE; currentArgName = *argIter; continue; - } + } const multi_map::iterator multiIter = multi.find(*argIter); - if (multiIter != multi.end()) - { + if (multiIter != multi.end()) { insideValues = MULTI; currentArgName = *argIter; continue; - } + } - switch(insideValues) - { + switch (insideValues) { case SINGLE: single[currentArgName] = *argIter; insideValues = NONE; @@ -145,56 +132,43 @@ bool cmParseArgumentsCommand default: unparsed.push_back(*argIter); break; - } } + } // now iterate over the collected values and update their definition // within the current scope. undefine if necessary. for (options_map::const_iterator iter = options.begin(), end = options.end(); - iter != end; ++iter) - { + iter != end; ++iter) { this->Makefile->AddDefinition(prefix + iter->first, - iter->second? "TRUE": "FALSE"); - } + iter->second ? "TRUE" : "FALSE"); + } for (single_map::const_iterator iter = single.begin(), end = single.end(); - iter != end; ++iter) - { - if (!iter->second.empty()) - { + iter != end; ++iter) { + if (!iter->second.empty()) { this->Makefile->AddDefinition(prefix + iter->first, iter->second.c_str()); - } - else - { + } else { this->Makefile->RemoveDefinition(prefix + iter->first); - } } + } for (multi_map::const_iterator iter = multi.begin(), end = multi.end(); - iter != end; ++iter) - { - if (!iter->second.empty()) - { - this->Makefile->AddDefinition(prefix + iter->first, - cmJoin(cmMakeRange(iter->second), ";") - .c_str()); - } - else - { + iter != end; ++iter) { + if (!iter->second.empty()) { + this->Makefile->AddDefinition( + prefix + iter->first, cmJoin(cmMakeRange(iter->second), ";").c_str()); + } else { this->Makefile->RemoveDefinition(prefix + iter->first); - } } + } - if (!unparsed.empty()) - { + if (!unparsed.empty()) { this->Makefile->AddDefinition(prefix + "UNPARSED_ARGUMENTS", cmJoin(cmMakeRange(unparsed), ";").c_str()); - } - else - { + } else { this->Makefile->RemoveDefinition(prefix + "UNPARSED_ARGUMENTS"); - } + } return true; } |