[Lldb-commits] [PATCH] D125219: [lldb][NFC] Simplify GenerateOptionUsage
David Spickett via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon May 16 03:57:39 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4a94e3801dd7: [lldb][NFC] Simplify GenerateOptionUsage (authored by DavidSpickett).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125219/new/
https://reviews.llvm.org/D125219
Files:
lldb/source/Interpreter/Options.cpp
Index: lldb/source/Interpreter/Options.cpp
===================================================================
--- lldb/source/Interpreter/Options.cpp
+++ lldb/source/Interpreter/Options.cpp
@@ -390,8 +390,6 @@
void Options::GenerateOptionUsage(Stream &strm, CommandObject &cmd,
uint32_t screen_width) {
- const bool only_print_args = cmd.IsDashDashCommand();
-
auto opt_defs = GetDefinitions();
const uint32_t save_indent_level = strm.GetIndentLevel();
llvm::StringRef name = cmd.GetCommandName();
@@ -402,6 +400,7 @@
if (num_options == 0)
return;
+ const bool only_print_args = cmd.IsDashDashCommand();
if (!only_print_args)
strm.PutCString("\nCommand Options Usage:\n");
@@ -413,19 +412,16 @@
// [options-for-level-1]
// etc.
- uint32_t num_option_sets = GetRequiredOptions().size();
-
if (!only_print_args) {
+ uint32_t num_option_sets = GetRequiredOptions().size();
for (uint32_t opt_set = 0; opt_set < num_option_sets; ++opt_set) {
- uint32_t opt_set_mask;
-
- opt_set_mask = 1 << opt_set;
if (opt_set > 0)
strm.Printf("\n");
strm.Indent(name);
// Different option sets may require different args.
StreamString args_str;
+ uint32_t opt_set_mask = 1 << opt_set;
cmd.GetFormattedCommandArguments(args_str, opt_set_mask);
// First go through and print all options that take no arguments as a
@@ -475,12 +471,9 @@
}
if (args_str.GetSize() > 0) {
- if (cmd.WantsRawCommandString() && !only_print_args)
+ if (cmd.WantsRawCommandString())
strm.Printf(" --");
-
strm << " " << args_str.GetString();
- if (only_print_args)
- break;
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125219.429677.patch
Type: text/x-patch
Size: 1875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220516/77031e9b/attachment-0001.bin>
More information about the lldb-commits
mailing list