diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Commands/CommandObjectApropos.cpp | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2 |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/source/Commands/CommandObjectApropos.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectApropos.cpp | 159 |
1 files changed, 77 insertions, 82 deletions
diff --git a/lldb/source/Commands/CommandObjectApropos.cpp b/lldb/source/Commands/CommandObjectApropos.cpp index 29e1f14..c70d021 100644 --- a/lldb/source/Commands/CommandObjectApropos.cpp +++ b/lldb/source/Commands/CommandObjectApropos.cpp @@ -1,4 +1,5 @@ -//===-- CommandObjectApropos.cpp ---------------------------------*- C++ -*-===// +//===-- CommandObjectApropos.cpp ---------------------------------*- C++ +//-*-===// // // The LLVM Compiler Infrastructure // @@ -13,10 +14,10 @@ // Project includes #include "CommandObjectApropos.h" #include "lldb/Interpreter/Args.h" -#include "lldb/Interpreter/Options.h" -#include "lldb/Interpreter/Property.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Interpreter/Options.h" +#include "lldb/Interpreter/Property.h" using namespace lldb; using namespace lldb_private; @@ -26,93 +27,87 @@ using namespace lldb_private; //------------------------------------------------------------------------- CommandObjectApropos::CommandObjectApropos(CommandInterpreter &interpreter) - : CommandObjectParsed(interpreter, "apropos", "List debugger commands related to a word or subject.", nullptr) -{ - CommandArgumentEntry arg; - CommandArgumentData search_word_arg; + : CommandObjectParsed( + interpreter, "apropos", + "List debugger commands related to a word or subject.", nullptr) { + CommandArgumentEntry arg; + CommandArgumentData search_word_arg; - // Define the first (and only) variant of this arg. - search_word_arg.arg_type = eArgTypeSearchWord; - search_word_arg.arg_repetition = eArgRepeatPlain; + // Define the first (and only) variant of this arg. + search_word_arg.arg_type = eArgTypeSearchWord; + search_word_arg.arg_repetition = eArgRepeatPlain; - // There is only one variant this argument could be; put it into the argument entry. - arg.push_back (search_word_arg); + // There is only one variant this argument could be; put it into the argument + // entry. + arg.push_back(search_word_arg); - // Push the data for the first argument into the m_arguments vector. - m_arguments.push_back (arg); + // Push the data for the first argument into the m_arguments vector. + m_arguments.push_back(arg); } CommandObjectApropos::~CommandObjectApropos() = default; -bool -CommandObjectApropos::DoExecute (Args& args, CommandReturnObject &result) -{ - const size_t argc = args.GetArgumentCount (); - - if (argc == 1) - { - const char *search_word = args.GetArgumentAtIndex(0); - if ((search_word != nullptr) - && (strlen (search_word) > 0)) - { - // The bulk of the work must be done inside the Command Interpreter, since the command dictionary - // is private. - StringList commands_found; - StringList commands_help; - - m_interpreter.FindCommandsForApropos (search_word, commands_found, commands_help, true, true, true); - - if (commands_found.GetSize() == 0) - { - result.AppendMessageWithFormat ("No commands found pertaining to '%s'. Try 'help' to see a complete list of debugger commands.\n", search_word); - } - else - { - if (commands_found.GetSize() > 0) - { - result.AppendMessageWithFormat ("The following commands may relate to '%s':\n", search_word); - size_t max_len = 0; - - for (size_t i = 0; i < commands_found.GetSize(); ++i) - { - size_t len = strlen (commands_found.GetStringAtIndex (i)); - if (len > max_len) - max_len = len; - } - - for (size_t i = 0; i < commands_found.GetSize(); ++i) - m_interpreter.OutputFormattedHelpText (result.GetOutputStream(), - commands_found.GetStringAtIndex(i), - "--", - commands_help.GetStringAtIndex(i), - max_len); - } - } - - std::vector<const Property *> properties; - const size_t num_properties = m_interpreter.GetDebugger().Apropos(search_word, properties); - if (num_properties) - { - const bool dump_qualified_name = true; - result.AppendMessageWithFormat ("\nThe following settings variables may relate to '%s': \n\n", search_word); - for (size_t i=0; i<num_properties; ++i) - properties[i]->DumpDescription (m_interpreter, result.GetOutputStream(), 0, dump_qualified_name); - - } - - result.SetStatus (eReturnStatusSuccessFinishNoResult); - } - else - { - result.AppendError ("'' is not a valid search word.\n"); - result.SetStatus (eReturnStatusFailed); +bool CommandObjectApropos::DoExecute(Args &args, CommandReturnObject &result) { + const size_t argc = args.GetArgumentCount(); + + if (argc == 1) { + const char *search_word = args.GetArgumentAtIndex(0); + if ((search_word != nullptr) && (strlen(search_word) > 0)) { + // The bulk of the work must be done inside the Command Interpreter, since + // the command dictionary + // is private. + StringList commands_found; + StringList commands_help; + + m_interpreter.FindCommandsForApropos(search_word, commands_found, + commands_help, true, true, true); + + if (commands_found.GetSize() == 0) { + result.AppendMessageWithFormat("No commands found pertaining to '%s'. " + "Try 'help' to see a complete list of " + "debugger commands.\n", + search_word); + } else { + if (commands_found.GetSize() > 0) { + result.AppendMessageWithFormat( + "The following commands may relate to '%s':\n", search_word); + size_t max_len = 0; + + for (size_t i = 0; i < commands_found.GetSize(); ++i) { + size_t len = strlen(commands_found.GetStringAtIndex(i)); + if (len > max_len) + max_len = len; + } + + for (size_t i = 0; i < commands_found.GetSize(); ++i) + m_interpreter.OutputFormattedHelpText( + result.GetOutputStream(), commands_found.GetStringAtIndex(i), + "--", commands_help.GetStringAtIndex(i), max_len); } + } + + std::vector<const Property *> properties; + const size_t num_properties = + m_interpreter.GetDebugger().Apropos(search_word, properties); + if (num_properties) { + const bool dump_qualified_name = true; + result.AppendMessageWithFormat( + "\nThe following settings variables may relate to '%s': \n\n", + search_word); + for (size_t i = 0; i < num_properties; ++i) + properties[i]->DumpDescription( + m_interpreter, result.GetOutputStream(), 0, dump_qualified_name); + } + + result.SetStatus(eReturnStatusSuccessFinishNoResult); + } else { + result.AppendError("'' is not a valid search word.\n"); + result.SetStatus(eReturnStatusFailed); } - else - { - result.AppendError ("'apropos' must be called with exactly one argument.\n"); - result.SetStatus (eReturnStatusFailed); - } + } else { + result.AppendError("'apropos' must be called with exactly one argument.\n"); + result.SetStatus(eReturnStatusFailed); + } - return result.Succeeded(); + return result.Succeeded(); } |