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/cmVariableWatchCommand.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/cmVariableWatchCommand.cxx')
-rw-r--r-- | Source/cmVariableWatchCommand.cxx | 96 |
1 files changed, 42 insertions, 54 deletions
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index b776626..f30ffe8 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -19,17 +19,18 @@ struct cmVariableWatchCallbackData std::string Command; }; -static void cmVariableWatchCommandVariableAccessed( - const std::string& variable, int access_type, void* client_data, - const char* newValue, const cmMakefile* mf) +static void cmVariableWatchCommandVariableAccessed(const std::string& variable, + int access_type, + void* client_data, + const char* newValue, + const cmMakefile* mf) { - cmVariableWatchCallbackData* data - = static_cast<cmVariableWatchCallbackData*>(client_data); + cmVariableWatchCallbackData* data = + static_cast<cmVariableWatchCallbackData*>(client_data); - if ( data->InCallback ) - { + if (data->InCallback) { return; - } + } data->InCallback = true; cmListFileFunction newLFF; @@ -42,54 +43,47 @@ static void cmVariableWatchCommandVariableAccessed( cmMakefile* makefile = const_cast<cmMakefile*>(mf); std::string stack = makefile->GetProperty("LISTFILE_STACK"); - if ( !data->Command.empty() ) - { + if (!data->Command.empty()) { newLFF.Arguments.clear(); newLFF.Arguments.push_back( - cmListFileArgument(variable, cmListFileArgument::Quoted, - 9999)); - newLFF.Arguments.push_back( - cmListFileArgument(accessString, cmListFileArgument::Quoted, - 9999)); + cmListFileArgument(variable, cmListFileArgument::Quoted, 9999)); newLFF.Arguments.push_back( - cmListFileArgument(newValue?newValue:"", cmListFileArgument::Quoted, - 9999)); + cmListFileArgument(accessString, cmListFileArgument::Quoted, 9999)); + newLFF.Arguments.push_back(cmListFileArgument( + newValue ? newValue : "", cmListFileArgument::Quoted, 9999)); newLFF.Arguments.push_back( - cmListFileArgument(currentListFile, cmListFileArgument::Quoted, - 9999)); + cmListFileArgument(currentListFile, cmListFileArgument::Quoted, 9999)); newLFF.Arguments.push_back( - cmListFileArgument(stack, cmListFileArgument::Quoted, - 9999)); + cmListFileArgument(stack, cmListFileArgument::Quoted, 9999)); newLFF.Name = data->Command; newLFF.Line = 9999; cmExecutionStatus status; - if(!makefile->ExecuteCommand(newLFF,status)) - { + if (!makefile->ExecuteCommand(newLFF, status)) { std::ostringstream error; error << "Error in cmake code at\nUnknown:0:\n" - << "A command failed during the invocation of callback \"" - << data->Command << "\"."; + << "A command failed during the invocation of callback \"" + << data->Command << "\"."; cmSystemTools::Error(error.str().c_str()); data->InCallback = false; return; - } - processed = true; } - if ( !processed ) - { + processed = true; + } + if (!processed) { std::ostringstream msg; msg << "Variable \"" << variable << "\" was accessed using " - << accessString << " with value \"" << (newValue?newValue:"") << "\"."; + << accessString << " with value \"" << (newValue ? newValue : "") + << "\"."; makefile->IssueMessage(cmake::LOG, msg.str()); - } + } data->InCallback = false; } static void deleteVariableWatchCallbackData(void* client_data) { - cmVariableWatchCallbackData* data - = static_cast<cmVariableWatchCallbackData*>(client_data); + cmVariableWatchCallbackData* data = + static_cast<cmVariableWatchCallbackData*>(client_data); delete data; } @@ -100,36 +94,31 @@ cmVariableWatchCommand::cmVariableWatchCommand() cmVariableWatchCommand::~cmVariableWatchCommand() { std::set<std::string>::const_iterator it; - for ( it = this->WatchedVariables.begin(); - it != this->WatchedVariables.end(); - ++it ) - { + for (it = this->WatchedVariables.begin(); it != this->WatchedVariables.end(); + ++it) { this->Makefile->GetCMakeInstance()->GetVariableWatch()->RemoveWatch( *it, cmVariableWatchCommandVariableAccessed); - } + } } -bool cmVariableWatchCommand -::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) +bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args, + cmExecutionStatus&) { - if ( args.size() < 1 ) - { + if (args.size() < 1) { this->SetError("must be called with at least one argument."); return false; - } + } std::string variable = args[0]; std::string command; - if ( args.size() > 1 ) - { + if (args.size() > 1) { command = args[1]; - } - if ( variable == "CMAKE_CURRENT_LIST_FILE" ) - { + } + if (variable == "CMAKE_CURRENT_LIST_FILE") { std::ostringstream ostr; ostr << "cannot be set on the variable: " << variable; this->SetError(ostr.str()); return false; - } + } cmVariableWatchCallbackData* data = new cmVariableWatchCallbackData; @@ -137,13 +126,12 @@ bool cmVariableWatchCommand data->Command = command; this->WatchedVariables.insert(variable); - if ( !this->Makefile->GetCMakeInstance()->GetVariableWatch()->AddWatch( - variable, cmVariableWatchCommandVariableAccessed, - data, deleteVariableWatchCallbackData) ) - { + if (!this->Makefile->GetCMakeInstance()->GetVariableWatch()->AddWatch( + variable, cmVariableWatchCommandVariableAccessed, data, + deleteVariableWatchCallbackData)) { deleteVariableWatchCallbackData(data); return false; - } + } return true; } |